Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple iScroll elements on same page

I'm making a mobile website with jQtouch and iScroll.

I wan't to get multiple scrollable areas with iScroll, but only of the lists works with iScroll...

I tried with this:

var scroll1, scroll2;
function loaded() {
   scroll1 = new iScroll('wrapper');
   scroll2 = new iScroll('list_wrapper');
}

But without luck. Anyone have a solution that's working?

My 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>
like image 239
Simon Thomsen Avatar asked Nov 04 '22 02:11

Simon Thomsen


1 Answers

I'm using this approach.

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 */ });
});

so anything with the class of "carousel" will become a slider.

like image 115
eth0 Avatar answered Nov 09 '22 12:11

eth0