问题
I would like to change fullpage.js dotted nav to an icon set. Each icon will represent each section. How can I manage to do that? Cannot find any solution of this.
Please advise.
Thanks.
回答1:
What about creating your own navigation bar?
Use navigation:false
.
Then create you own nav and use apply the method $.fn.fullpage.moveTo in each of the elements.
Reproduction online
$('#fullpage').fullpage({
sectionsColor: ['yellow', 'orange', '#C0C0C0', '#ADD8E6'],
onLeave: function(index, nextIndex, direction){
activateNavItem($('#my-nav').find('li').eq(nextIndex-1));
},
afterRender: function(){
activateNavItem($('#my-nav').find('li').eq($('.section.active').index()))
}
});
$('.fa-bell').click(function(){
var destination = $(this).closest('li');
$.fn.fullpage.moveTo(destination.index() + 1 );
});
function activateNavItem(item){
item.addClass('active').siblings().removeClass('active');
}
With my list using font-awesome icons:
<ul id="my-nav">
<li><i class="fa fa-bell" aria-hidden="true"></i></li>
<li><i class="fa fa-bell" aria-hidden="true"></i></li>
<li><i class="fa fa-bell" aria-hidden="true"></i></li>
<li><i class="fa fa-bell" aria-hidden="true"></i></li>
</ul>
来源:https://stackoverflow.com/questions/36733560/fullpage-js-change-dotted-nav-to-icon-set