cubiq / iscroll

Smooth scrolling for the web
http://iscrolljs.com
MIT License
12.87k stars 3.8k forks source link

iScroll 4 adobe cordova #511

Closed hatpick closed 11 years ago

hatpick commented 11 years ago

I follow the instructions in documentation and used iscroll.

in the directive I call the iScroll(elem). It creates the scoller but the problem is that scoller jumps back to the top when I try to scroll.

What I use: Adobe Cordova 3. AngularJS

davidpfahler commented 11 years ago

You need to delay instantiation of the scroller until all elements are in the DOM and the browser had a chance to layout and paint them. You could try something like:

// other stuff happens...
// elem is defined somewhere above
var iscroll;
setTimeout(function () {
  iscroll = new iScroll(elem);
}, 50);

Beside all that, iScroll 4 is deprecated. Please use iScroll 5. There are AngularJS directives available from other developers you could use.