When using the -webkit-overflow-scrolling: touch;
style on a mobile element, capturing the scroll
events can be extremely tiresome as they are triggered by 'flicking', 'panning' and when the scroll itself stops.
Unlike desktop browsers, this makes it a nightmare to try to detect when either, the element is currently being scrolled, or, the element has finished scrolling.
I have researched around SO and the web a hell of a lot and have ascertained that the only viable solution (that I can think of) is to create a function that captures the first touch of the scroll, ignores any subsequent pan
's and then captures the final scroll event.
If this could be accomplished, somehow, then an incremented value could represent scrollend
whenever it is even...
I have written the following but I have ommitted the touch
events as I do not really know where to start with this part:
var checklist_scroll = 0; // Whenever this value is even, it means the scroll has ended
$('ul').on('scroll',function(){
checklist_scroll++; // Only do this for 'scrollstart' and 'scrollend', NOT when panning through the list
});
Then, for any other event, you could do
$('li').on('tap',function(){
// Only make the elements selectable when parent is not scrolling
if(checklist_scroll%2===0){
// Select the li
}
});