Handling a click and a tap but not a scroll

162 views Asked by At

I have an Ember.View that handles both the click and touchEnd events, for both desktop and mobile interactions.

Unfortunately, touchEnd also gets fired when scrolling, which is not intended. How do I handle the click and tap, but avoid the scroll event?

Ember.View.extend({
  click: function() {
    // not handled in a mobile browser
  },
  touchEnd: function() {
    // handled in a mobile browser, but unfortunately also on scroll
  }
});
1

There are 1 answers

0
blessanm86 On

Instead of adding handlers for both click and touchEnd, use the fastclick library. Now you just need to add a handler for the click event. If your using ember-cli, there is an addon for this.