【发布时间】:2017-02-28 15:32:57
【问题描述】:
我正在努力获得
current slide / total slides
在 Fullpage.js 上,并在每次幻灯片更改时更新当前幻灯片。
我是 Javascript 的新手,我正在尝试解决此代码。数字会出现,但它们不会更新每张幻灯片的变化。
$(function() {
var sections = $('.section');
updateCurrentIndex(); //on document.ready and on each slidechange
function updateCurrentIndex() {
sections.each(function() {
var section = $(this),
sectionSlides = section.find('.slide'),
totalItems = sectionSlides.length,
currentIndex = sectionSlides.filter('.active').index() + 1,
numContainer = section.find('.num'); //assuming you have numContainers in every section
numContainer.html("0" + currentIndex + ' / ' + totalItems);
});
}
});
任何帮助将不胜感激。
【问题讨论】:
标签: javascript jquery slideshow counter fullpage.js