简体   繁体   中英

Cannot scroll horizontally with iScroll

I want to scroll horizontally the inner divs in the following html:

<div id="outer">
  <div id="inner">
    <div class="cell">
        cell 1
    </div> 
    <div class="cell">
        cell 2
    </div> 
    <div class="cell">
        cell 3
    </div> 
  </div>
</div> 

Im using iscroll to do this. However, im not able to scroll, though the scrollStart event is triggered as I try to scroll. The jsfiddle is here . Any ideas?

You can do it without using iScroll.

In CSS, change the #outer overflow value to "scroll" as below

#outer{
    ...
    overflow:scroll;
}

Simply set scrollX to true, like this:

var scroll = new IScroll('#outer', {
    scrollX: true
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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