[BUG] onScrollEnd can be interrupted and never called

148 views
Skip to first unread message

ScottyE

unread,
Apr 17, 2012, 4:12:49 PM4/17/12
to isc...@googlegroups.com
Hi, hopefully this is the right place for reporting a bug.

Executive Overview
When binding a function to onScrollEnd when creating a new iScroll instance, the onScrollEnd event can be canceled and never called even if no scrolling takes place by clicking or tapping within one second after the initial tap/click.

Workaround
Bind a function or call to onTouchEnd event to check & call the function or event in onScrollEnd.

Example
myScroll = new iScroll('scrollWrapper', {
snap:false, vScroll:false, hScroll:true, scrollbarClass: 'myScrollbar', bounce:true,
onScrollEnd: function () {
$.event.trigger('onScrollEnded');
}, onTouchEnd: function () {
$.event.trigger('onScrollEnded');
}
});

$('# scrollWrapper ').bind('onScrollEnded', function() {
$('# scrollWrapper ').unbind('onScrollEnded');
 // do stuff
}

Note, this workaround in my example only works without a double trigger effect because I immediately unbind the function once it's called.

Of course, this could just be something I'm doing wrong as well, but thought I'd mention.
Reply all
Reply to author
Forward
0 new messages