iScroll jQuery plugin + options.onResize + option.snapThreshold

719 views
Skip to first unread message

Gildas THORAVAL

unread,
Mar 1, 2012, 1:36:10 PM3/1/12
to isc...@googlegroups.com
Hey every body
I've made few changes for myself to iScroll,
and I think these changes may interest others (and maybe good enouth to be integrated to the official iScroll?).

  • a jquery plugin for iscroll (at the end of the file), very usefull for jquery lovers:
    $('.myScrolls').scrollCreate({hScroll:false,on...});
    $('.myScrolls').scrollTo(…);
    if ( ! $('.myScrolls')[0].iScroll.animating) {}
    $('.myScrolls').scrollRefresh();
    $('.myScrolls').scrollDisable();
    $('.myScrolls').scrollRemove();
    no need to store the iScroll object anymore.

  • added a onResize event,
    called when the size of the wapper change.
    by default this method do: this.scrollToPage(this.currPageX, this.currPageY, 0);
    that avoid a bug: onorientationchange, snap scrolls are not snaped

  • fix: recalculate currPageX/Y on every scroll change and not only during the scrollToPage call (for the default onResize method work)

  • change: option.snapThreshold (default 1px too short) is now the ration of the width or height a swipe must have to change page (default 1/4).

you can see diff between my file in attachment and the latest version of iScroll (v4.1.9 in the header)

iscroll.modified.js

Kevin Siml

unread,
Jul 3, 2012, 6:17:33 AM7/3/12
to isc...@googlegroups.com
i also need a longer swipe detection, but your changes don't work! Can you help me.?

Greets kevin

Jon Tara

unread,
Jul 3, 2012, 1:26:28 PM7/3/12
to isc...@googlegroups.com
If you can take the time, it would be good to fork iscroll on Github, and then make your changes to your fork. Then others can use git to see the differences between your fork and the original. It also makes it easy for you to submit pull request to Mateo.
Reply all
Reply to author
Forward
0 new messages