I need to add class for #menu
only when the '#pagepiling .section:first-child'
is active. While scrolling the class must be removed. I need to check the condition on every scroll.
$(window).scroll(function () {
alert("woow");
if($('#pagepiling .section:first-child').hasClass('active')) {
$("#menu").addClass("sticky");
}
});
Please check the code from here https://codepen.io/anon/pen/PagXLw
You can use "onLeave" callback action (read the documentation) and check if the slide is the first or not. Something like this https://codepen.io/anon/pen/wXZVjB