简体   繁体   English

iscroll无法自动运行

[英]The iscroll doesn't work automatically

I am trying to scroll div in ipad. 我正在尝试在ipad中滚动div。 I use iscroll. 我使用iscroll。 Like this: 像这样:

$(document).on("pagecreate",function(event){
     var myScroll = new IScroll('#devicesContent',  {
         click:true
     });
});

But what I see is strange: it doesn't work automatically. 但是我看到的很奇怪:它不会自动运行。 If I open it on landscape it doesn't scroll. 如果我在横向上打开它,则不会滚动。 If I change the orientation and then it scrolls, or if I open it on portrait and I need to change orientation for landscape and then it scrolls. 如果更改方向然后滚动,或者在纵向打开它并且需要更改横向的方向然后滚动。 What am I missing? 我想念什么?

$(document).on("pagecreate", function(event){
    var myScroll = new IScroll('#devicesContent', { 
        eventPassthrough: true, // add this
        click:true,
        scrollX: true, 
        scrollY: false
    });
});

Seems like the issue is with your pagecreate event. 看来问题出在您的pagecreate事件上。 Try "pageshow" instead. 尝试使用“页面显示”。

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

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