how can i get the div's current postion with jquery or divs current placement with jquery
+1
A:
Check out the "CSS" section of the jQuery docs, in particular the #offset
function.
T.J. Crowder
2009-12-20 11:26:05
+1
A:
var position = jQuery('#myelement').position();
alert(position.left);
alert(position.top);
J-P
2009-12-20 11:27:28
`#position` gives the position relative to the offset parent. The OP didn't exactly give us much to work with, but I'm guessing he needs relative to the doc (`#offset`). And yes, those names seem backward to me. :-)
T.J. Crowder
2009-12-20 11:40:54
A:
Do you mean position on your web page? This depends on the browser you are using. They handle code in a different way sometomes...
You can check your app via Firebug in Firefox or Webdeveloper Toolbar in Internet Explorer for getting the right values.
bastianneu
2009-12-20 11:27:51
A:
try position
function.
var pos=$("#ID_OF_DIV").position();
alert("TOP: " + pos.top +"\r\nLEFT: " + pos.left);
TheVillageIdiot
2009-12-20 11:36:06