How can I determine the direction of a jQuery scroll event?

后端 未结 25 1491
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-21 22:24

I\'m looking for something to this effect:

$(window).scroll(function(event){
   if (/* magic code*/ ){
       // upscroll code
   } else {
      // downscrol         


        
25条回答
  •  囚心锁ツ
    2020-11-21 23:08

    stock an increment in the .data () of element scrolled, you will then be able to test number of times the scroll reached top.

提交回复
热议问题