$(this).animate({ width: mywidth + "px" }); think:
var newwidth = { "width": mywidth + "px" } Regards On Thu, Apr 30, 2009 at 5:54 PM, paper_robots <mresto...@gmail.com> wrote: > > I'm trying to get the width of an element, animate it bigger, then > shrink it back to normal size on hover. Here's my function: > > > $('a.slider').hover(function(){ > var mywidth = $(this).width(); > $(this).animate({width: "240px"}); > }, function(){ > $(this).animate({width: +mywidth+px"}); > }); > > > The line I'm having trouble with is: > $(this).animate({width: +mywidth+px"}); > > I know its not concatenated right, but I tried a few ways and couldn't > get it to work. What am I doing wrong? Thanks in advanced! >