0

I'm using vclick from jQuery mobile to eliminate the click delay on mobile devices. It mostly works fine, however if I have a scrollable element and I touch-scroll it, vclick is fired at the coordinates where I touched the element to initiate the scroll.

I have a scrollable list, where clicking/tapping an item initiates some further actions. When I simply scroll the list, the vclick is fired on the item which I touched to scroll the whole list. I haven't found any ways around it.

How can I get around it? I only want the vclick on actual tap, not on scroll.

I can, probably, handle the touchstart event and save the coordinates. Then handle touchend event instead of vclick and compare the coordinates with those from touchstart - and only perform actions if they are the same. Yet this sounds really ugly to me.

EDIT: using tap instead of vclick exhibits the same behavior, therefore it's also not a solution.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Aleks G
  • 56,435
  • 29
  • 168
  • 265
  • Disable vclick on `scrollstart`, enable it on `scrollstop`. – Omar Jan 06 '14 at 23:18
  • Something like this http://jsfiddle.net/Palestinian/3F7vR/ – Omar Jan 06 '14 at 23:30
  • @Omar Thanks, but that would make my code totally unreadable. Majority of lists and list items are created dynamically and all elements are added dynamically based on some other selections that user makes; and all events are attached dynamically - and these events can be hundreds of lines of code each... – Aleks G Jan 06 '14 at 23:35
  • what about creating a custom event using `touchstart` and `touchend`? – Omar Jan 07 '14 at 09:48

0 Answers0