Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/384.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript iOS设备上的滚动功能_Javascript_Jquery_Ios_Jquery Mobile_Scroll - Fatal编程技术网

Javascript iOS设备上的滚动功能

Javascript iOS设备上的滚动功能,javascript,jquery,ios,jquery-mobile,scroll,Javascript,Jquery,Ios,Jquery Mobile,Scroll,我调用以下代码: $(document).scroll(function() { thedistance(); }); 我希望在用户在iOS设备上向下滚动页面时触发distance(),但不是这样,而是在用户停止滚动后触发函数,而不是在过程中触发 我听说这是由于用户滚动时DOM操作冻结造成的-从2016年起,有没有办法解决这个问题?我尝试了下面的解决方案,效果很好 <!DOCTYPE html> <html> <head>

我调用以下代码:

$(document).scroll(function() {
    thedistance(); 
});
我希望在用户在iOS设备上向下滚动页面时触发
distance()
,但不是这样,而是在用户停止滚动后触发函数,而不是在过程中触发


我听说这是由于用户滚动时DOM操作冻结造成的-从2016年起,有没有办法解决这个问题?

我尝试了下面的解决方案,效果很好

<!DOCTYPE html>
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1">
            <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
                <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
                <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
                <script>
                    $(document).on("pagecreate","#pageone",function(){
                                   $(document).on("scrollstart",function(){
                                                  alert("Started scrolling!");
                                                  });
                                   });
                    </script>
    </head>
    <body>
        <div data-role="page" id="pageone">

        </div> 
    </body>
</html>

$(文档).on(“pagecreate”,“#pageone”,function()){
$(文档).on(“scrollstart”,函数(){
警报(“开始滚动!”);
});
});
还要注意此链接,这可能会有所帮助

你可以在这里找到你想要的东西:@wigi我尝试过这些答案,但没有成功。如果有,我需要一个解决方案。谢谢你的回复-我尝试了
scrollstart
,但在iPad上,直到用户停止滚动,它才会发出警报。我发现了W3Schools的一句话:“iOS设备在滚动期间冻结DOM操作,这意味着用户滚动时不可能更改某些内容。然而,jQuery团队正在为此制定解决方案。”。看来暂时不可能。