Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
添加部分中的类“.active”时,如何删除标题中的类“.visible”?“.active”是通过插件通过滚动动态添加的。
<header class="visible"> <div id="menu-bar"> </div> </header> <section class="part-one active" data-panel="start"> </section>
您可以使用setInterval()来不断检查是否已添加该类。
setInterval()
function checkForClass(){ if ($("section").hasClass("active")) { $("header").removeClass("visible") } setInterval('checkForClass()',1000)//every 1 second... }
或者,修改插件以在成功添加类时删除.active类
.active