Javascript jQuery:滑块检测向下滚动或向上滚动

Javascript jQuery:滑块检测向下滚动或向上滚动,javascript,jquery,Javascript,Jquery,我有一个脚本,它将使一个简单的滑块按钮导航 现在我需要通过滚动来控制这个滑块 当用户向下滚动时,将移动到下一个滑块也会反转 按钮也将可用。因此,关于如何控制它,将有两个选项。带有“下一步”和“上一步”按钮,也可以向下或向上滚动 有没有办法用最简单的方法来做这件事 var lottieone=document.getElementById('lottieone'); var lottietwo=document.getElementById('lottietwo'); var lottiethr

我有一个脚本,它将使一个简单的滑块按钮导航

现在我需要通过滚动来控制这个滑块

当用户向下滚动时,将移动到下一个滑块也会反转

按钮也将可用。因此,关于如何控制它,将有两个选项。带有“下一步”和“上一步”按钮,也可以向下或向上滚动

有没有办法用最简单的方法来做这件事

var lottieone=document.getElementById('lottieone');
var lottietwo=document.getElementById('lottietwo');
var lottiethree=document.getElementById('lottiethree');
var lottiefour=document.getElementById('lottiefour');
$('#lottieone').show();
$('#lottietwo').hide();
$('#lottiethree').hide();
$('#lottiefour').hide();
函数任务幻灯片(){
$('#lottieone').hide();
$('#lottietwo').show();
$('#lottiethree').hide();
$('#lottiefour').hide();
}
函数任务slidebacc(){
$('#lottieone').hide();
$('#lottietwo').show();
$('#lottiethree').hide();
$('#lottiefour').hide();
}
函数研究幻灯片(){
$('#lottieone').hide();
$('#lottietwo').hide();
$('#lottiethree').show();
$('#lottiefour').hide();
}
功能教育幻灯片(){
$('#lottieone').hide();
$('#lottietwo').hide();
$('#lottiethree').hide();
$('#lottiefour').show();
}

家
使命
下一个
研究
返回
下一个
教育
返回

尝试使用此代码段

$(document).on('mousewheel','.slider',函数(e){
var delta=e.originalEvent.wheelDelta;
如果(增量>0)警报(“向上滚动”);
如果(增量<0)警报(“向下滚动”);
e、 预防默认值();
});