防止将活动 class 添加到 fullpage.js 上的部分

Prevent from adding active class to section on fullpage.js

加载 fullpage.js 页面的第一部分时,它会将 active class 添加到该部分。问题是 class 在幕后触发动画,所以用户会看到完成的动画。如何防止 fullpage.jsactive class 添加到该部分?

您可以为此使用 fullpage.js 事件回调函数,

    onLeave: function(index, nextIndex, direction){},
    afterLoad: function(anchorLink, index){},
    afterRender: function(){},
    afterResize: function(){},
    afterResponsive: function(isResponsive){},
    afterSlideLoad: function(anchorLink, index, slideAnchor, slideIndex){},
    onSlideLeave: function(anchorLink, index, slideIndex, direction, nextSlideIndex){}

查看此文档https://github.com/alvarotrigo/fullPage.js/

离开第一张幻灯片时,将回调函数添加到 onLeave: 以从该元素中删除活动的 class,例如

$('.class').fullpage({
onLeave: function(index, nextIndex, direction){
// remove the active class here
}
});