保持jqueryui覆盖在相同的DOM位置 [英] keep jqueryui overlay in same DOM position

查看:69
本文介绍了保持jqueryui覆盖在相同的DOM位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

反正是否有一个jQueryUI覆盖物保持在相同的DOM位置?

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

HTML

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

JS:

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

如果您在DOM上进行检查,您会注意到叠加层已移动到document.body

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

有什么办法可以将其保持在起始位置? (div#parent的直子)?

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

推荐答案

不确定为什么要这样做,但是类似: http://jsfiddle.net/BGBuc/应该可以帮助您入门.

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

这篇关于保持jqueryui覆盖在相同的DOM位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆