Backbone.js - Both click and double click event getting fired on an element

后端 未结 3 2060
小鲜肉
小鲜肉 2020-12-19 02:16

In my Backbone View, I have defined events like this:

events : {
  \'click .elm\' : \'select\',
  \'dblclick .elm\' : \'toggle\'

},

select: function(e){
           


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-19 02:41

    This isn't an issue with Backbone itself. It's about how to handle both single click and double click events on the same button.

    See

    1. Need to cancel click/mouseup events when double-click event detected

    2. Javascript with jQuery: Click and double click on same element, different effect, one disables the other

    Update: But it would be better if you didn't have to deal with it. See mu is too short's answer below!

提交回复
热议问题