How can I get the div's current postion with jQuery or divs current placement wit开发者_如何转开发h jQuery
var position = jQuery('#myelement').position();
alert(position.left);
alert(position.top);
Check out the "CSS" section of the jQuery docs, in particular the #offset
function.
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.
try position
function.
var pos=$("#ID_OF_DIV").position();
alert("TOP: " + pos.top +"\r\nLEFT: " + pos.left);
精彩评论