1

How can I remove the class ".visible" in header when the class ".active" in section is added? ".active" is dynamically added trough scrolling via a plugin.

<header class="visible">
    <div id="menu-bar">
    </div>
</header>

<section class="part-one active" data-panel="start">
</section>
andalusi
  • 265
  • 1
  • 2
  • 10
  • possible duplicate of [How to detect class changing by DOMAttrModified](http://stackoverflow.com/questions/17172470/how-to-detect-class-changing-by-domattrmodified) – Reinstate Monica Cellio Oct 03 '13 at 20:22

1 Answers1

1

You could use setInterval() to continously check to see if the class has been added.

function checkForClass(){
    if ($("section").hasClass("active")) {
        $("header").removeClass("visible")
    }
   setInterval('checkForClass()',1000)//every 1 second...
}

Or alternatively, amend the plugin to remove the class on successfully adding the .active class

97ldave
  • 5,249
  • 4
  • 25
  • 39