3 ms·
It is pretty simple to implement, you increment a variable on 'touchmove' event, and check on 'touchend' if the variable is less then 3. If it is, you can call
by plehoux 14y ago
It is pretty simple to implement, you increment a variable on 'touchmove' event, and check on 'touchend' if the variable is less then 3. If it is, you can call your click function.
- mrpollo 14y agothanks for that
- radarsat1 14y agohm. seems like something that the browser should handle for you... don't see why every website should have its own debouncing code.
- jahewson 14y agoAh, but then 3px drags are not allowed, which might ruin your web-based diagram editor or game. Also the granularity of the denouncing will change depending on the size of the click target, so it's really app-specific.
- rwallace 14y agoMuch better to break the rare case of three pixel drags than the common case of, well, clicks! It's not realistic to expect every web programmer to start knowing about tablets. The default should be a reasonable amount of denoising, with a way for the page to change that default when needed.
- betterth 14y agoEspecially considering most web dev's will just implement jquery-ui or somesuch draggable library that will handle the proper 3px drag fix for them.