0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

iOS环境下<iframe>标签上拉事件无效

Last updated at Posted at 2019-03-29

背景

在Web应用程序中,有的列表需要异步加载,这时候通常就会支持上拉加载更多和下拉刷新事件。在某个项目中,我们用到的是jQuery WeUI中的组件。奇怪的是,在Android环境下运行正常,但是在iOS环境下却出现上拉事件无效。

寻找原因

在该项目中,使用的是父页面中包括了子页面,并且使子页面响应上拉事件:

Parent.html
<style>
#wrapper {
    height: 100%;
}
iframe {
    width: 100%;
    height: 100%;
    margin: 100%;
    padding: 100%;
    border: 100%;
}
</style>
<div id="wrapper">
    <iframe src="" name="list"></iframe>
</div>

在jQuery WeUI中上拉加载更多使用的是下面的js代码:

IFrame.js
var loading = false;
$(document.body).infinite().on("infinite", function() {
    if (loading) return;
    loading = true;
    setTimeout(function() {
        // load data and add to list...
        loading = false;
    }, 1500);
});

但是用Safari实时调试的时候并没有响应这个方法。

解决

  • 比较简便的方法是给``
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?