javascript scroll event for iPhone/iPad?

后端 未结 5 1701
不知归路
不知归路 2020-11-22 15:38

I can\'t seem to capture the scroll event on an iPad. None of these work, what I am doing wrong?

window.onscroll=myFunction;

document.onscroll=myFunction;

         


        
5条回答
  •  独厮守ぢ
    2020-11-22 16:37

    Since iOS 8 came out, this problem does not exist any more. The scroll event is now fired smoothly in iOS Safari as well.

    So, if you register the scroll event handler and check window.pageYOffset inside that event handler, everything works just fine.

提交回复
热议问题