jquery dialog: dragging dialog with iframe inside

蓝咒 提交于 2019-12-06 04:08:02

问题


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();

回答1:


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 :)




回答2:


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();
    }



回答3:


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

var iframe=document.createElement('IFRAME');    
iframe.css('z-index', '-999');
$(div).append(iframe)
       .dialog();


来源:https://stackoverflow.com/questions/3388868/jquery-dialog-dragging-dialog-with-iframe-inside

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!