homepage Welcome to WebmasterWorld Guest from 54.204.77.26
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
unsetting/restting jQuery CSS
sssweb




msg:4529369
 5:17 pm on Dec 18, 2012 (gmt 0)

What is the best way to remove CSS properties that have been set via jQuery?

I have code like this:

$("#block).animate({top: "+=100px"});

The way my page works, I don't know how many times the code has run, so when I want to reset, I don't know the exact location of #block. I know I can specifically set it anywhere using:

$("#block).css({"top": 100});

but I'd rather remove all animate()'s applied to it, letting it revert to its normal place in the page flow. Can I do that?

 

sssweb




msg:4529374
 5:35 pm on Dec 18, 2012 (gmt 0)

[RESOLVED]

The obvious seems to work:

$("#block).css({"top": 0});

unless anyone has a comment.

sssweb




msg:4529379
 5:52 pm on Dec 18, 2012 (gmt 0)

FYI for others reading this, I just discovered this works too:

$("#block).css({"top": ""});

(blank string removes any css property: [api.jquery.com...] )

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved