javascript - Change text when div has multiple classes -


i trying create function can change text of , forward arrows when specific slide active. i'm using fullpage.js create slides.

the slides formatted this:

<div class="slide start table active">slide content </div> <div class="slide doelwitten table">slide content </div> <div class="slide strategie table">slide content </div> <div class="slide troepen table">slide content </div> 

whenever slide active class active assigned slide so:

<div class="slide start table active">slide content </div> 

and code trying out achieve result

if ( $('.slide').hasclass('doelwitten') && $('.slide').hasclass('active')) {              $('.controlarrow.prev p').text('link1')              $('.controlarrow.next p').text('link2')         }  if ( $('.slide').hasclass('start') && $('.slide').hasclass('active')) {              $('.controlarrow.prev p').text('link2')              $('.controlarrow.next p').text('link3')         } 

but when test code first function executed , texts of links don't change when specific slide turned active.

i'm pretty new jquery advice appreciated. have been searching 3hours guess it's time :)

thanks in advance!

you have use plugin callbacks such afterslideload one.

$('#fullpage').fullpage({     afterslideload: function (anchorlink, index, slideanchor, slideindex) {          var currentactiveslide = $('.section').eq(index - 1).find('.slide').eq(slideindex);          if (currentactiveslide.hasclass('start')) {             $('.controlarrow.prev p').text('link2')             $('.controlarrow.next p').text('link3')         }     } }); 

live demo


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -