【发布时间】:2017-07-20 13:05:58
【问题描述】:
这个问题被问了很多次,但不知道为什么进展不顺利。
我正在尝试模拟滚动以获得更多灵活性,但需要有很多条件。向上或向下渐变到淡入和淡出div 时,我得到一个鼠标滚轮事件。它正在使用一个 div,但无法使用更多。
我正在JSFiddle做一个演示
$('body').bind('mousewheel', function(e) {
if ($('.ecampus').css('opacity') == '1') {
if (e.originalEvent.wheelDelta / 120 > 0) {
// TOP PAGE
} else {
$('.pegasebuzz').fadeOut();
$('.notrecoin').fadeIn();
}
}
else if ($('.pegasebuzz').css('opacity') == '1') {
if (e.originalEvent.wheelDelta / 120 > 0) {
$('.pegasebuzz').fadeOut();
$('.ecampus').fadeIn();
} else {
$('.pegasebuzz').fadeOut();
$('.notrecoin').fadeIn();
}
}
else ($('.notrecoin').css('opacity') == '1') {
if (e.originalEvent.wheelDelta / 120 > 0) {
$('.notrecoin').fadeOut();
$('.pegasebuzz').fadeIn();
} else {
// BOTTOM PAGE
}
}
});
【问题讨论】:
-
检查this
-
@Durga 我使用了一个类似的库(Scrollify.js),但我需要在没有真正的滚动条的情况下进行操作,因为在我的情况下它不能正常工作。我正在寻找带有鼠标滚轮的固定过渡。喜欢这个网站(除了第一页):www.studio-dot.fr
-
@Leshautsdurant 检查我的答案,如果你觉得有用,请标记。
标签: javascript jquery if-statement mousewheel