LoginSignup
6
6

More than 5 years have passed since last update.

jquery的offset在zoom时的问题

Last updated at Posted at 2015-09-08

当zoom时,jquery的offset无法获得正确的值。

解决方法是,使用原生的offsetTop。
即,

jQuery:

var top = $("#something").offset().top;

Native JavaScript:

var top = document.getElementById("something").offsetTop;

demo地址

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6