这很简单。我正试图找到一种获取活动部分索引号的方法。我希望滚动到其他部分时更改数字。
我想要实现的目标:Demo
利用fullPage.js callbacks或state 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);
}