Fullpage.js - Change Dotted Nav to Icon Set

后端 未结 1 1718
独厮守ぢ
独厮守ぢ 2020-12-04 01:08

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.

P

相关标签:
1条回答
  • 2020-12-04 01:46

    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>
    
    0 讨论(0)
提交回复
热议问题