问题
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