Tuesday, 27 August 2013

Create element at absolute position?

Create element at absolute position?

I'm trying to insert an element into the DOM, essentially a floating box.
completely outside the normal flow of elements, overlapping anything
beneath it, at a particular position.
I was trying:
$('body').append('<div id="popup" style="width:30px; height:30px;">HEY
THERE</div>');
$('#popup').position({ my: 'left top', at: 'left bottom', of:
$('a').first() });
But wasn't getting any results. I'm trying to position the floating box
directly beneath the first anchor tag in the document.
It's getting put in the DOM, but it's not being positioned right.
Possibly I should be using insert, or some sort of combination of relative
and absolute positioning?

No comments:

Post a Comment