jQuery get position of element relative to another element

后端 未结 4 1818
旧时难觅i
旧时难觅i 2020-12-08 18:28

So I have a div like:

And I want to know the position

4条回答
  •  长情又很酷
    2020-12-08 18:58

    just do the subtraction your self...

    var relativeY = $("elementA").offset().top - $("elementB").offset().top;

提交回复
热议问题