Backbone.js 点击事件不适用于触摸
events:
'click' : 'select'
在 Mobile Safari 上使用此事件时,该事件会在触摸时触发两次.这是一个已知的错误还是我自己造成的?
When using this event on Mobile Safari the event gets triggered twice when touched. Is this a known bug or something that I am causing on my own?
我已经把它改成了
events:
'touchstart' : 'select'
它工作得很好,但意味着它不再在普通浏览器中工作了.
and it works great but means that it will not work in normal browsers anymore.
感谢您提供任何信息.
推荐答案
试试这个代码:
TouchView = Backbone.View.extend({
events: function() {
return MOBILE ?
{
"touchstart": 'select'
} :
{
"mousedown": 'select'
}
}
}
查看实际操作:http://jsfiddle.net/dira/Ke2px/2/一个>
相关文章