How do I get the scroll position of a document?

前端 未结 9 1740
面向向阳花
面向向阳花 2020-12-12 20:53

How to get the scroll position value of a document?

9条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-12 21:21

    Try this:

    var scrollHeight = $(scrollable)[0] == document ? document.body.scrollHeight : $(scrollable)[0].scrollHeight;
    

提交回复
热议问题