fullpage.js - 获取活动的Section Index编号

问题描述 投票:-1回答:1

这很简单。我正试图找到一种获取活动部分索引号的方法。我希望滚动到其他部分时更改数字。

我想要实现的目标:Demo

fullpage.js
1个回答
0
投票

利用fullPage.js callbacksstate classes

注意你在回调上有slideIndex

afterSlideLoad: function(anchorLink, index, slideAnchor, slideIndex){
    //do whatever here
    $(body).append(slideIndex);
}, 

因为afterSlideLoad回调不会因部分更改而被触发,所以您还需要使用afterLoad回调并使用fullPage.js添加的状态类来获取幻灯片编号:

afterLoad: function(anchorLink, index){
    var slideNumber = $('.fp-section.active').find('.fp-slide.active').index() + 1
 //do whatever here
    $(body).append(slideNumber);
}
© www.soinside.com 2019 - 2024. All rights reserved.