I have a cordova app for ipad that uses iScroll to scroll among pages.
All worked fine until i upgraded to iScroll5.
I changed my code, to use new constructor and parameters, but it still doesn't work. It simply doesn't scroll.
I don't know if i'm missing something obvious, but I cannot find an exaustive documentation about the upgrade.
This is an example of how I used it before (iScroll4):
var options = {hScroll:false, hScrollbar:false, snap:true, onScrollEnd: updatePages(), momentum: false};
var scroller = new iScroll("wrapper", options);
And this is how I use it now (iScroll5):
var options = {scrollX: false, snap: true, momentum: false};
var scroller = new IScroll("#wrapper", options);
scroller.on("scrollEnd", updatePages());
Any help is greatly appreciated! Thanks!
So, first things first, in your "scrollEnd" event instead of passing the updatePages()
function as a parmeter, you are calling it. So it will run only once, when the page is loaded not on scrollEnd. You should change it to:
scroller.on("scrollEnd", updatePages);
If that alone doesn't fix your problem, then you should propably check your CSS.
From iscroll.js documentation:
[...]remember that the script needs to know the height/width of the scrolling area.
That means:
If your #wrapper
element is positioned relative or static then you should have explicitly defined height with some relative unit (% won't work).
If your #wrapper
element is positioned absolute or fixed then you should either apply the rule above or you could use top
and bottom
instead (both must be specified).
If it still won't work, then make sure your IScroll object is initiated after the DOM is ready, but considering it worked for you before, this isn't the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With