I am not very good with jQuery but what I want to achieve is a loop that will continually check the body tag for a certain class and will then preform an if statement when the class is attached to the body. My website has various fullscreen sections on my homepage and the class for the body will update as I scroll through the sections to reflect which section is currently on screen. I want to be able to keep checking the body tag until, for example, section 2 (class is "fp-viewing-2") is displayed at which stage I will preform some css animations.
if ($("body").hasClass("fp-viewing-2")){
$("#sec3text1").removeClass("hidden");
$("#sec3text1").addClass("animated fadeInLeft");
};
This is the general logic however this is only checked once when the page loads and I need it to continually check until body has the class "fp-viewing-2".
Thanks in advance.