Using jquery scrollTop to position absolute Div -


Depending on where I'm clicking on the page, try creating a full DIV status using Jquery I am doing

At the moment it just works great

  $ ('# window'). CSS ('left', jsquent.pagex); $ ('# Window') Css ('top', jquery event);  

This element is given the place where my mouse clicked on the screen ...

Unless you scroll down. This is the reason why I'm trying to achieve something that will keep the pixels in mind from the top of the page. I thought something like this ...

  $ ('# window'). Css ('top', jsv, pagwai + scrollpop ());  

You have to do the trick, unfortunately it does not work.

Any hint?

Thanks,

Tim

This is definitely Works in Firefox. As such, it should work in Chrome, Safari and Opera. However, I'm not completely sure. Give it a shot.

  $ ('# window'). CSS ({left: e.clientX, top: e.clientY + document.documentElement.scrollTop});  

Edit: This new version should work in most, if not all browsers.

  var rxp = / webkit / gi; $ ('# Window') CSS ({left: e.clientX, top: e.clientY + rxp.test (window.navigator.userAgent)? Document.body.scrollTop: document.documentElement.scrollTop});  

Comments