How to target current “stage” of fullpage.js using jQuery

谁说我不能喝 提交于 2019-12-24 09:46:39

问题


How can I target the current "stage" of fullpage.js ? Meaning - how can I tell jQuery to detect the fourth stage that I have added a class of "homeFour" to?

Here is my markup:

    <div id="fullpage" style="height: 100%; position: relative;" class="fullpage-wrapper">
        <div class="section homeOne fp-section fp-table" style="height: 915px;"><div class="fp-tableCell" style="height:915px;">
        </div></div>
        <div class="section homeTwo fp-section fp-table" style="height: 915px;"><div class="fp-tableCell" style="height:915px;">
        </div></div>
        <div class="section homeThree fp-section fp-table" style="height: 915px;"><div class="fp-tableCell" style="height:915px;">Section Three</div></div>
        <div class="section homeFour fp-section fp-table active fp-completely" style="height: 915px;"><div class="fp-tableCell" style="height:915px;">Section Four</div></div>
    </div>

What I need to do is, tell jQuery that WHEN the section fp-section fp-table active fp-completely has a class of homeFour like so - section homeFour fp-section fp-table active fp-completely to do something else?

So far it activates when I load the page and does not function as expected.


回答1:


Try something like this:

$('#fullpage').fullpage({
    afterLoad (anchorLink, index, slideAnchor, slideIndex){
        if($(".homeFour").is(".active")){
            // Do stuff
        }
    },
    //...
});


来源:https://stackoverflow.com/questions/38460928/how-to-target-current-stage-of-fullpage-js-using-jquery

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