How to get the top position of an element?

前端 未结 4 874
青春惊慌失措
青春惊慌失措 2020-12-24 00:14

Is it possible to get the top position of an element using javascript/jquery ?

The element is a table, if that matters.

4条回答
  •  旧巷少年郎
    2020-12-24 01:10

    $("#myTable").offset().top;
    

    This will give you the computed offset (relative to document) of any object.

提交回复
热议问题