我正在使用 jQtouch 和 iScroll 制作一个移动网站。
我不想使用 iScroll 获得多个可滚动区域,但只有列表中的列表适用于 iScroll...
我试过这个:
var scroll1, scroll2;
function loaded() {
scroll1 = new iScroll('wrapper');
scroll2 = new iScroll('list_wrapper');
}
但运气不好。 谁有有效的解决方案?
我的 html:
<div id="wrapper">
<ul>
<li><a href="#">Test</a></li>
</ul>
</div>
<div id="list_wrapper">
<ul>
<li><a href="#">Test</a></li>
</ul>
</div>
最佳答案
我正在使用这种方法。
HTML:
<div class="carousel" id="alt-indie">
<div class="scroller">
<ul>
<li></li>
// etc
</ul>
</div>
</div>
JS:
$('.carousel').each(function (index) {
new iScroll($(this).attr('id'), { /* options */ });
});
所以任何具有“旋转木马”类的东西都将成为 slider 。
关于javascript - 同一页面上的多个 iScroll 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9976972/