6

Jquery 单击事件在设备中的 li 上不起作用。我尝试使用 click 和 touchstart 事件,但使用 touchstart 时的问题是我无法向下滚动 div。当我尝试通过单击 li 向下滚动时,它被选中。有没有办法使用任何 jquery 事件而不是 jquery 移动事件来选择和滚动 li?

$('#liId').on({ 'touchstart' : function(){ console.log('Event Fired'} });
4

3 回答 3

9

The issue is solved when I added a style class to all li.

.liClass { cursor : pointer; }

于 2013-10-16T07:04:57.993 回答
1

在“touchstart”之前替换:,解包{}

$('#liId').on( 'touchstart', function(){ 
 console.log('Event Fired');
});
于 2013-10-16T06:02:29.193 回答
0

在你的 CSS 文件中

#liId { cursor : pointer; }

jQuery

$('#liId').click(function(){
    alert('Event Fired');
});
于 2016-05-27T13:35:09.123 回答