Fullpage.js - Change Dotted Nav to Icon Set

馋奶兔 提交于 2019-11-26 17:25:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!