Backbone.js click event doesn't work with touch

后端 未结 8 1811
-上瘾入骨i
-上瘾入骨i 2020-12-16 02:46
events: 
    \'click\' : \'select\'

When using this event on Mobile Safari the event gets triggered twice when touched. Is this a known bug or some

8条回答
  •  北海茫月
    2020-12-16 03:15

    Try this code:

    TouchView = Backbone.View.extend({
      events: function() {
        return MOBILE ? 
           {
             "touchstart": 'select'
           } : 
           {
             "mousedown": 'select'
           }
      }
    }
    

    See it in action: http://jsfiddle.net/dira/Ke2px/2/

提交回复
热议问题