jquery dialog: dragging dialog with iframe inside

2019-03-30 09:04发布

When dragging a jquery dialog with an iframe inside , the drag stops if the mouse goes over the frame contents while dragging. It seems that the iframe takes automatically the focus. is there any way to prevent this and make drag normal?

var iframe=document.createElement('IFRAME');    
$(div).append(iframe)
       .dialog();

3条回答
太酷不给撩
2楼-- · 2019-03-30 09:14

from naugtur suggestion i found this good working solution:

dragStart:function(){
    var divt=document.createElement('div');
    $(divt).attr('id','tempdragdiv');
     divt.style.height='93%';
    divt.style.width='100%';
    $(divt).css('position','absolute').css('left','0')  .css('top','0');                    
    $(div).append(divt);//div where is iframe
    },
    dragStop:function(){
        $('#tempdragdiv').remove();
    }
查看更多
Juvenile、少年°
3楼-- · 2019-03-30 09:18

have you tried setting a z-index for the iframe?

var iframe=document.createElement('IFRAME');    
iframe.css('z-index', '-999');
$(div).append(iframe)
       .dialog();
查看更多
神经病院院长
4楼-- · 2019-03-30 09:21

It's just my guess, but I'd try covering everything with a transparent div 100% width&height while dragging and assuring it's above iframes and under the dragged thingie :)

查看更多
登录 后发表回答