我使用One Page Scroll进行全屏轮播。我想data-attribute
在分页中显示。到目前为止,我能够在分页中显示幻灯片的数量。我怎样才能进入data-attribute
分页?
在这里,我想在分页中显示年份。
HTML
<div id="main" class="main">
<section data-year="1950" class="page1">
<div class="page_container">
<h1>Forward Thinking</h1>
<p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua"</p>
</div>
</section>
<section data-year="1960" class="page2">
<div class="page_container">
<h1>iPhone 5S</h1>
<p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."</p>
</div>
</section>
</div>
JavaScript
$('ul.onepage-pagination li a').each(function() {
var elem = $(this);
var li = elem.parent();
var ul = li.parent();
elem.html((li.index() + 1) + '/' + ul.children().length);
});