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

时间:2018-02-28 05:54:36

标签: fullpage.js

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

我想要实现的目标: Demo

1 个答案:

答案 0 :(得分:0)

使用WalkthroughfullPage.js callbacks

请注意,回调中有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);
}
相关问题