[英]iScroll not working on iPhone for jquery show/hide
I am building a phonegap application with iscroll used for scrolling. 我正在使用用于滚动的iscroll构建一个phonegap应用程序。 I am facing a problem when I dynamically append controls to a div and show/hide the div on click.
我将控件动态附加到div并在单击时显示/隐藏div时遇到问题。 The div shows up and then hides automatically.
div出现,然后自动隐藏。 I have given the code samples below.
我在下面给出了代码示例。 Would greatly apperciate any help.
将非常感谢任何帮助。
First I tried with scroll.refresh() alone, but since it did not work, I tried destroying and recreating according to a forum post in google. 首先,我尝试单独使用scroll.refresh(),但是由于它无法正常工作,因此我尝试根据google上的论坛帖子销毁并重新创建。 But, it does not work either.
但是,它也不起作用。
<div class="wrapper" id="wrapper">
<main class="content" id="scroller">
<ul>
<li>
<span id="usertype-link">
</span>
<div class="b-preferences__select b-preferences__select--type" id="search-user-type-div">
</div>
</li>
</ul>
</main>
</div>
$('#search-user-type-div').hide();
$('#usertype-link').bind('click', function () {
if ($('#search-user-type-div').is(":visible")) {
$('#search-user-type-div').hide();
$('#usertype-link').removeClass('open').addClass('close');
}
else {
$('#search-user-type-div').show();
$('#usertype-link').removeClass('close').addClass('open');
}
//scroll.refresh();
searchpreferences.rebuildScroll();
})
rebuildScroll: function () {
scroll.destroy();
scroll = null;
scroll = new iScroll('wrapper', { vScrollbar: true, hScrollbar: false, vScroll: true, hScroll: false, onBeforeScrollStart: null });
//setTimeout(function () {
scroll.refresh();
//}, 0);
}
Any help would be appreciated. 任何帮助,将不胜感激。
Priyan 普里亚恩
I don't have an exact solution, but I recommend to use the most recent version of iScroll (v5) . 我没有确切的解决方案,但是我建议使用最新版本的iScroll(v5) 。 It was totally rebuild and maybe fixes your problem.
这是完全重建,也许可以解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.