benbarnett / jquery-animate-enhanced

Extend $.animate() to detect CSS transitions for Webkit, Mozilla, IE>=10 and Opera and convert animations automatically.
http://playground.benbarnett.net/jquery-animate-enhanced/
MIT License
1.39k stars 196 forks source link

Play nice with existing transforms #5

Open benbarnett opened 13 years ago

benbarnett commented 13 years ago

Existing transforms on elements are being overwritten when animating the left/top properties with this plugin.

Initial fix

mgcrea commented 13 years ago

Had this issue with this div & a fadeTo animation :

    -webkit-transition: -webkit-transform 300ms ease-out;
    -webkit-transform : translate3d(0, -600px, 0);

    &.ui-state-active {
        -webkit-transform : translate3d(0, 0, 0);
    }

This seems to be a fix (when animated property is != from existing one) :

    -webkit-transition: -webkit-transform 300ms ease-out;
    -webkit-transition-property: all !important;
    -webkit-transform : translate3d(0, -600px, 0);

    &.ui-state-active {
        -webkit-transform : translate3d(0, 0, 0);
    }

Great work anyway, Regards,

benbarnett commented 13 years ago

This is exactly the sort of thing I want to fix. If only time was more generous. I'm working on it though, will post on here with progress.

danro commented 13 years ago

I think I am running into this issue as well. When I try to implement the following code on mouseover / mouseout, the transforms get reset if mouseout gets dispatched while the mouseover animation is playing, and the position of my tabs (in this case) go wacky.

function $tabOver () {
    $(this).stop().animate({top: "12px"},{queue:false, duration:200, easing:"easeOutQuart"})  
}
function $tabOut () {
    $(this).stop().animate({top: "20px"},{queue:false, duration:400, easing:"easeInOutQuart"})  
}
benbarnett commented 13 years ago

Yep that's a good example of this one. Thanks.