如何检测事件是由脚本还是鼠标滚轮调用的?
示例代码:
$(window).scroll(function(event){
// detecting here is scroll called by some script( $.scrollTo('#somediv') for sample ) or by mousewheel
});
最佳答案
$(window).scroll(function(e) {
if(!e.isTrigger) {
// mouse wheel
console.log('wheeeeeel');
}
});
关于jquery:如何检测事件是由脚本还是鼠标滚轮调用的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12048036/