Jquery的click事件在设备上不能在li元素上正常工作。我尝试使用click和touchstart事件,但是当使用touchstart时,问题在于我无法滚动div。当我试图通过点击li来向下滚动时,它会被选中。是否有任何一种方法可以使用任何jquery事件而不是jquery移动事件来选择和滚动li元素?
$('#liId').on({ 'touchstart' : function(){ console.log('Event Fired'} });
Jquery的click事件在设备上不能在li元素上正常工作。我尝试使用click和touchstart事件,但是当使用touchstart时,问题在于我无法滚动div。当我试图通过点击li来向下滚动时,它会被选中。是否有任何一种方法可以使用任何jquery事件而不是jquery移动事件来选择和滚动li元素?
$('#liId').on({ 'touchstart' : function(){ console.log('Event Fired'} });
:
替换为,
并在'touchstart'之前取消{}
包装$('#liId').on( 'touchstart', function(){
console.log('Event Fired');
});
#liId { cursor : pointer; }
jQuery
$('#liId').click(function(){
alert('Event Fired');
});
$('#liId').on( 'touchstart', function(){ console.log('Event Fired'); });
- Vucko