CSS3/Javascript: Transitions IE support using jQuery/Modernizr

Problem

Does anyone know how I could achieve IE 7-9 support for (this in Codepen.io) button hover effect?

eg specifically:

transition-duration: 0.5s;
transition-property: all;
transition-timing-function: ease;
margin-top: 5px;

I tried this, however, margin-top will not animate. Others seem to..

What am I doing wrong?? Grateful for any help.

I have jQuery, Modernizr...

Thanks A lot

Harley

(Apologies in advance if this is a blatant duplicate, just I seem to have a particular problem)

Problem courtesy of: harley_woop

Solution

Your problem is this line:

$(this).animate({margin-top:'5px'},{queue:false,duration:500});

You'll either need to quote the CSS value or use camelcase:

$(this).animate({marginTop:'5px'},{queue:false,duration:500});
$(this).animate({'margin-top':'5px'},{queue:false,duration:500});

This pretty much applies to all CSS values with hyphens etc.

Solution courtesy of: adeneo

Discussion

There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.