Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery - Making fadeOUt use !important

I have created a jQuery widget for other people to embed on their website, and within the widget I am using a css reset stylesheet called "cleanslate" from here:

https://github.com/premasagar/cleanslate

This stops the page style creeping into my widget.

Problem is that my fadeOut and fadeIn's are no longer working because the reset style is overriding the display inline style jQuery is adding. I need to make the fadeOut function add !important; to the inline style.

Does anyone know if this is possible?

Thanks in advance.

like image 233
superphonic Avatar asked Mar 22 '23 00:03

superphonic


1 Answers

I came up with the solution below, hope it helps someone else in the same situation.

All comments / improvements welcome:

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

Thanks

like image 197
superphonic Avatar answered Mar 28 '23 05:03

superphonic