keep jqueryui overlay in same DOM position

余生长醉 提交于 2020-01-06 20:06:15

问题


Is there anyway to keep a jQueryUI overlay in the same DOM position?

Take a look at this

HTML

<div id="parent">
    <div id="over" title="title">
        Stuff
    </div>
</div>

JS:

$('#over').dialog({modal: true});

If you inspect it on the DOM, you'll notice that the overlay gets moved to a direct child of document.body

Is there any way to keep it in it's starting position? (direct child of div#parent)?


回答1:


Not sure why you want this, but something like: http://jsfiddle.net/BGBuc/ should get you started.

JS

$('#over').dialog({
    modal: true,
    create:function(event, ui) {
        setTimeout(function(){
            $('#parent').append($('div.ui-widget-overlay')).append($('div.ui-dialog'));
        },1);
    }
});​


来源:https://stackoverflow.com/questions/10033228/keep-jqueryui-overlay-in-same-dom-position

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