简体   繁体   English

jQuery滚动位置在实际的Ipad中不起作用

[英]jquery Scroll position doesn't work in real Ipad

So i am trying to load a content through ajax when reaching a particular position. 所以我试图在到达特定位置时通过ajax加载内容。 Below function works pretty good in web page, ipad emulator but doesn't work as expected in real ipad. 下面的功能在网页,ipad模拟器中非常有效,但在实际的ipad中却无法正常工作。 In real ipad, it doesn't load at the exact position but little later. 在实际的ipad中,它不会加载到确切的位置,但稍后会加载。

  var monitorScrollPosition = function () {
    var reach_point_top = $("#ldp-mainmap-container").offset().top;
    $(window).scroll(function () {
      var scroll_position_top = $(window).scrollTop();
      var scroll_position_bottom = scroll_position_top + $(window).height();
      if ((scroll_position_bottom > reach_point_top) && count < 1) {
        loadContent();
      }
    });
  };

On iPad or any other iOS devices, onscroll event is fired only after you've stopped scrolling. 在iPad或任何其他iOS设备上,仅在您停止滚动后才触发onscroll事件。

See this stackoverflow answer by kennytm about this subject : https://stackoverflow.com/a/2863570/3455109 请参阅kennytm关于此主题的stackoverflow答案: https : //stackoverflow.com/a/2863570/3455109

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM