简体   繁体   English

将类添加到正文时,将类添加到另一个元素

[英]Add Class to another element when class is added to body

I am trying to check for when a class is added to the body but my code isn't working, is anyone able to help me? 我正在尝试检查何时将类添加到正文中,但是我的代码不起作用,有人可以帮助我吗?

function checkFordone() {
    if ($("body").hasClass("done")) {
        $("#mainbar").addclass("finished");
    } else {
        setTimeout(checkFordone, 100);
    }
}

jsFiddle jsFiddle

addclass不是函数,请使用addClass!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM