How to get scrollbar position with Javascript?

前端 未结 9 2398
自闭症患者
自闭症患者 2020-11-22 11:23

I\'m trying to detect the position of the browser\'s scrollbar with JavaScript to decide where in the page the current view is. My guess is that I have to detect where the t

9条回答
  •  孤城傲影
    2020-11-22 11:46

    If you are using jQuery there is a perfect function for you: .scrollTop()

    doc here -> http://api.jquery.com/scrollTop/

    note: you can use this function to retrieve OR set the position.

    see also: http://api.jquery.com/?s=scroll

提交回复
热议问题