Backbone.js click event doesn't work with touch

后端 未结 8 1810
-上瘾入骨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:28

    I've solved the same issue generically by creating backbone.touch for Backbone that will monkey patch Backbone.View to respond to touch events when a touch device is used, or regular click events when not.

    You can either just include the source file to have it transform all of your click events in Backbone.Views, or you can take a peek at the code and implement it yourself.

    0 讨论(0)
  • 2020-12-16 03:28

    I defined both events types and it works for me on a mobile and desktop:

    events: {
    'click' : 'select',
    'touchstart' : 'select'
    }
    
    0 讨论(0)
提交回复
热议问题