Using jquery scrollTop to position absolute Div
- by Tim
Hello,
I am trying to position an Absolute DIV using Jquery, depending on where the user is clicking on the page.
At the moment this works just great
$('#window').css('left', jsEvent.pageX);
$('#window').css('top', jsEvent.pageY);
This positions the element exactly where my mouse has clicked the screen...
Until you scroll down that is. That is why I am trying to achieve something that will take the amount of pixels from the top of the page into account. I thought something like this...
$('#window').css('top', jsEvent.pageY + scrollTop());
would do the trick, unfortunately it doesn't work.
Any hints?
Thanks,
Tim