jQuery - 使用fadeOUt!重要

sup*_*nic 3 javascript css jquery widget

我已经为其他人创建了一个jQuery小部件嵌入他们的网站,在小部件中我使用了一个名为"cleanslate"的css reset样式表:

https://github.com/premasagar/cleanslate

这会阻止页面样式进入我的窗口小部件.

问题是我的fadeOut和fadeIn不再有效,因为重置样式覆盖了displayjQuery添加的内联样式.我需要使fadeOut函数添加!important;到内联样式.

有谁知道这是否可能?

提前致谢.

sup*_*nic 5

我想出了下面的解决方案,希望它在同样的情况下帮助其他人.

欢迎所有评论/改进:

    jQuery("element").fadeOut("slow", function() {
        jQuery("element").attr("style", "display: none !important");
    });
Run Code Online (Sandbox Code Playgroud)

谢谢