【发布时间】:2022-06-26 12:31:15
【问题描述】:
我使用两个事件(scroll 和 mousewheel)。
我想为mousewheel 事件获取deltaY 来控制滑块。
变量getDelta 返回数字和undefined,尽管我在mousewheel 事件中的条件。
我想在外面获取deltaY 值。
请问怎么了?提前谢谢你。
$(window).on('scroll mousewheel', function(e) {
if (e.type == "mousewheel") {
var getDelta = e.deltaY;
}
console.log(getDelta);
}
【问题讨论】:
标签: javascript jquery