keep jqueryui overlay in same DOM position

Go To StackoverFlow.com

0

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

2012-04-05 17:34
by qwertymk
When you put it as modal then it can only be a child of body, because it overlays all other children of body - Sven Bieder 2012-04-05 17:38
@SvenBieder: And if I wouldn't have it as a modal - qwertymk 2012-04-05 17:48
Then it should normally stay in the original position. But I haven't tried it - Sven Bieder 2012-04-05 19:31


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);
    }
});​
2012-04-05 20:59
by Brandon Boone
Ads