【问题标题】:Add class to non-active sections in FullPage.js将类添加到 FullPage.js 中的非活动部分
【发布时间】:2015-06-26 22:11:47
【问题描述】:

对于那些熟悉 fullpage.js 的人,我想知道您是否能够将类添加到非活动部分。具体来说,我想知道是否有一种方法可以将不同的类添加到当前活动部分之前和之后的部分。

例如,如果能够在当前幻灯片之前的所有部分添加“before-current”类,并为所有其他部分添加“after-current”类,并在您浏览时添加/删除类,那就太好了所有部分。

【问题讨论】:

    标签: jquery fullpage.js


    【解决方案1】:

    你可以使用 afterLoad 事件

    $('#fullpage').fullpage({
        sectionsColor: ['#1bbc9b', '#4BBFC3', '#7BAABE', 'whitesmoke', '#ccddff'],
        anchors: ['firstPage', 'secondPage', '3rdPage', '4thpage', 'lastPage'],
        menu: '#menu',
        scrollingSpeed: 1000,
        afterLoad: function(anchorLink, index){
                $(".section").removeClass("prev-section").removeClass("next-section");
                $(this).prev(".section").addClass("prev-section");
                $(this).next(".section").addClass("next-section");
            }
        });
    });
    

    【讨论】:

    • 谢谢米尔顿!现在看来如此明显。我想我想得太多了。
    猜你喜欢
    • 2016-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多