Alex Rivera | Logout

Scroll bar in Phonegap?

Asked 2012-09-10T08:11:40.780
8

I am new to Phonegap. I am displaying a list of data in a list view. The data is collected from a server and I want to add a scroll bar to the view. How to add a scroll bar in Phonegap and make the view scrolling sticky? Jow to make it smooth? Please guide me to do this.

Thanks in advance.

Edit
Report

1 Answer

-1

Use iscroll.

Steps

function loaded() {
  document.addEventListener('touchmove', function(e){ e.preventDefault(); });
  myScroll = new iScroll('scroller');
}
document.addEventListener('DOMContentLoaded', loaded);`

<div id="wrapper">
<div id="scroller">
    <ul>
        <li>...</li>
    </ul> 
</div> 

The #wrapper also needs some classes:

#wrapper {
  position:relative;
  z-index:1;
  width:/* your desired width, auto and 100% are fine */;
  height:/* element height */;
  overflow:/* hidden|auto|scroll */;
}

Check this example demo

answered 2012-09-10T08:43:11.820

Your Answer