Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Clear css :after declaration with jquery

Clear css :after declaration with jquery

Problem

I have the following css Declaration in place:

#envelope:after
{
    z-index: -1;
    position: absolute;
}

How do I remove it (set it to empty at least) with Jquery at runtime?

Problem courtesy of: Maxim V. Pavlov

Solution

You can't really "remove" a css rule with jQuery but you can override it for a specific item (or list of items) depending on used selector.

When you are talking about removing it, don't you mean setting a new value instead ?

So if you want to "remove" your z-index, just set it to

.css('z-index', 'auto')

which is the default value

Same for position

.css('position', 'static')
Solution courtesy of: Mordhak

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

Clear css :after declaration with jquery

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×