tags:

views:

513

answers:

2
$("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.

A: 

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

Bruno De Barros
After @Max Shawabkeh told me it was working for him on jQuery 1.4.2 I realised I was running an old 1.2.6 jQuery, and updating made padding-left work.
Bruno De Barros
A: 

thank you 谢谢. 问题解决了.

玄古耀月