jQuery: position() on created element
- by Parched Squid
The following code creates a div at the bottom of the page:
var popup = $('<div id="popup" />')
.appendTo('body');
The following code causes it to position correctly once there.
$('#popup')
.position({ my: 'left top', at: 'left bottom', of: $('#someDiv') });
But this code causes it to appear in the DOM but not be positioned anywhere (it is not visible, but it is in the DOM).
var popup = $('<div id="popup" />')
.appendTo('body')
.position({ my: 'left top', at: 'left bottom', of: $('#someDiv') });
Is there a trick to being able to use jQuery position() on an item you are creating?
Cheers,
Craig