This was an old post, but if you're still interested I've been thinking about a CSS parser with Andy Kent (for jss). It reads all the stylesheets and style elements and assembles them into one large JSON. It's at http://youngisrael-stl.org/wordpress/blogfiles/cssparser/cssparser.jquery.js and if you include it you can do:
var style = $.parsecss()['.myclassname']; if (style) $('#widget').animate(style); Unfortunately animate throws an error if style is undefined, so it needs the guard condition. Let me know if this is helpful. Danny On Nov 3, 10:12 pm, "S. Robert James" <[EMAIL PROTECTED]> wrote: > I have a animation using jQuery, which goes from one position to > another. Right now, the positions are coded into JavaScript: > > $("#widget").animate({top: '500px'}) > > Instead of hard-coding 500px into JavaScript, or even passing it as a > parameter, I'd much rather set them in CSS, and run the animation from > that. That keeps all the design & layout together, and allows > identical JavaScript to work with both of them. Something like: > > #widget.down { > top: 300px;} > > #widget.up { > top: 500px;} > > $("#widget").animate({class: 'up'}) > > Any jQuery hacker's have a suggestion on how to do something like > that? Is it possible to read the values off of the CSS stylesheet? > > (In general, what's everyone's opinion about this method. I think > it's a lot cleaner, keeping cohesion up and coupling down...)