Question

I want to make a horizontal scroller using iScroll but it wont work. I get the attributes on the correct divs but am unable to scroll. Here's the js:

//called on onload
var levelPackScroller;
function init() {
    levelPackScroller = new IScroll('#levelButtonPreScroller')
    levelPackScroller.refresh()
}

html:

<div id="levelButtonPreScroller">
    <div class="levelButtonScroller" id="levelButtonScroller">
         //bunch of <divs> go inside here
         <div></div>

    </div>
</div>

css:

.levelButtonScroller {
   width: 2800px;
   height: 938px;
}

#levelButtonPreScroller {
   position: absolute;
   height: 945px;
   width: 711px;
   overflow: hidden;
   left: 55px;
}

help?

Was it helpful?

Solution

From the iScroll documentation:

By default only vertical scrolling is enabled. If you need to scroll horizontally you have to set scrollX to true. See horizontal demo.

You should add

levelPackScroller = new IScroll('#levelButtonPreScroller', {
   scrollX : true
})

Source

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top