jquery-animate-enhanced icon indicating copy to clipboard operation
jquery-animate-enhanced copied to clipboard

Play nice with existing transforms

Open benbarnett opened this issue 14 years ago • 4 comments

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

Initial fix

  • Cache existing transforms and re-apply after internal callbacks
  • Ignore elements with existing translations (don't want to add too much weight with the Matrix calculations)

benbarnett avatar Dec 22 '10 09:12 benbarnett

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,

mgcrea avatar Feb 28 '11 13:02 mgcrea

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.

benbarnett avatar Mar 01 '11 12:03 benbarnett

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"})  
}

danro avatar Mar 16 '11 02:03 danro

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

benbarnett avatar Mar 18 '11 06:03 benbarnett