Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox/IE don't animate padding-left with jQuery (only able to get Chrome to animate)

$("a").hover(function(){
    $(this).animate({
        'padding-left': '+=10px'
    }, "normal");
}, function(){
    $(this).animate({
        'padding-left': '-=10px'
    }, "normal");
});

I have the above piece of code, which would normally animate the padding of an "a" tag on hover. This works fine in Chrome, but not on Firefox nor IE. At first, I thought it could be because of my CSS or something, so I added CSS to add the padding on hover, and it worked. It's only the jQuery animation that isn't working. So I'm at a loss as to what it might be. Any ideas? Thanks in advance.

like image 290
Bruno De Barros Avatar asked Mar 07 '10 00:03

Bruno De Barros


1 Answers

Changing 'padding-left' to paddingLeft worked, for some strange reason. I thought about it after seeing backgroundColor in another piece of javascript.

like image 51
Bruno De Barros Avatar answered Nov 11 '22 00:11

Bruno De Barros