jquery:如何检测脚本或鼠标滚轮调用的事件?

jquery:如何检测脚本或鼠标滚轮调用的事件?,jquery,events,Jquery,Events,如何检测脚本或鼠标滚轮调用的事件 对于此代码示例: $(window).scroll(function(event){ // detecting here is scroll called by some script( $.scrollTo('#somediv') for sample ) or by mousewheel }); 我通常使用一个附加参数,并在对该函数的动态调用中使用它 $('.item').click(function(event,explicit) { if (

如何检测脚本或鼠标滚轮调用的事件

对于此代码示例:

$(window).scroll(function(event){
// detecting here is scroll called by some script( $.scrollTo('#somediv') for sample ) or by mousewheel
});


我通常使用一个附加参数,并在对该函数的动态调用中使用它

$('.item').click(function(event,explicit) {
    if (explicit) console.log("I'm called explicitly!");
})

可以像
$('.item')一样触发。触发('click',true)

他可能;lp查找事件
鼠标滚轮
,希望它适合您的需要!对塔斯·因尼特来说:这不一定是一个滚动事件,滚动事件只是为了sample@underfined当我使用$.scrollTo(目标)时,控制台也会显示“Wheeeeeel”您在使用IE吗?将
console.log
更改为
alert('texthhere')当调用$.scrollTo('#someid')时,当我用鼠标滚动显示“Wheel”时,必须不显示“Wheel”
$('.item').click(function(event,explicit) {
    if (explicit) console.log("I'm called explicitly!");
})