jquery - fullPage.js onLeave event triggers -


i attempting trigger 2 css events when switching sections on fullpage.js app. please see fiddle of i'm @ here: http://jsfiddle.net/pingo_/67oe1jvn/2/

i following 2 things:

  • change class of fa-stack icons attributes under hover when leave page (currently color changing on click/hover, change if use scrolls)
  • change color of navigation nodes #ffffff when background color #004e7b (currently cannot see nodes in sections 2 , 4)

what best way achieve this? have code @ bottom of javascript breakout attempts trigger message when leave section one. messes scrolling , skips way last section:

var fromsection1 = false; $('#fullpage').fullpage({          onleave: function(index, direction){      var leavingsection = $(this);     //after leaving section 2     if(index == 1 && direction =='down'){       alert("going section 2!");     }else{       fromsection1 = false;     }   } }); 

and similar trigger change of class fa-nav sections? have not written in css, bc not sure if should done there, in javascript, or in both. have not injected class attributes before , having lot of difficulty these two. please advise best approach , see if able help. !!

you working in answer provided 1 year ago... onleave event has 3 parameters intead of 2 can see here in documentation.

onleave: function(index, nextindex, direction){

regarding questions, change class need javascript. maybe that's not need.

check out this video.

remember fullpage.js adds class active active section, , in body element adds class fp-viewing-xxx xxx anchor name of current section or index if no anchors provided.

this way can play css:

#demo{     color: red; }   /* applied on section anchor `firstpage` */      body.fp-viewing-firstpage #demo{     color: blue; }  

Comments