Example online
试试这个:
var myIntervalId;
var auto = true;
$('#fullpage').fullpage({
sectionsColor: ['yellow', 'orange', '#C0C0C0', '#ADD8E6'],
continuousVertical: true,
afterLoad: function (anchorLink, index){
//for any section
if(typeof myIntervalId === 'undefined' || !auto){
clearInterval(myIntervalId);
myIntervalId = setInterval(function() {
$.fn.fullpage.moveSectionDown();
}, 1000);
}
}
});
addMouseWheelHandler();
function MouseWheelHandler() {
clearInterval(myIntervalId);
auto = false;
}
function addMouseWheelHandler() {
if (document.addEventListener) {
document.addEventListener('mousewheel', MouseWheelHandler, false); //IE9, Chrome, Safari, Oper
document.addEventListener('wheel', MouseWheelHandler, false); //Firefox
} else {
document.attachEvent('onmousewheel', MouseWheelHandler); //IE 6/7/8
}
}
嗨阿尔瓦罗 - 谢谢你回来这么快。我可能没有正确解释这个... 我需要自动滚动重新激活后,用户用鼠标停止它,然后5秒钟无效。在JSFiddle中,鼠标滚轮会停止自动滚动,但不会重新激活。 提前致谢,并对错误沟通感到抱歉。 埃文。 – Evan
@Evan这个例子在用户停止时重新激活滚动。再次审查。你可以测试它滚动。它会在1秒后再次激活。 (只是把它改为5你的情况) – Alvaro
对不起,它不适用于我:(我已经在Safari,Firefox和Chrome中试过了,我能够以某种方式给你看一个屏幕截图吗? – Evan