On page scroll new class is added to a child and if the class is added to the child then also a new class should be added to the parent.
This is my code (wrapped like this because of the Drupal framework):
(function($) {
Drupal.behaviors.myClasses = {
attach: function (context, settings) {
if($("#navigation").hasClass("stickynav-active")){
$("#header-wrapper").addClass("sticky-active");
}
}
};
})(jQuery);
#header-wrapper is the parent. If I scroll down the stickynav-active is added (by some module) to #navigation so it starts existing after scrolling down, but my code doesn't add sticky-active to #header-wrapper?