开发者

getting div current placement

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜