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

Issue with Left 0 #156

Closed chris-shaw-2011 closed 10 years ago

chris-shaw-2011 commented 10 years ago

If you're doing a transition to left 0 it appears that the objects get reset when the animation completes. If the transition is changed to anything but 0 it works the way you would expect. Also if I remove the reference to animate enhanced and just use normal jquery animate it works properly.

Below is an example of this bug:

<!DOCTYPE html>
<html>
    <head>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.0.2.js"></script>
<script type="text/javascript" src="jquery.animate-enhanced.js"></script>
<style type="text/css">
    #left, #right
    {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
    }

#left
{
    background-color: red;
}

#right
{
    background-color: blue;
    left: 100%;
}
</style>
<script type="text/javascript">
    function slideLeft()
    {
        var right = $("#right");
        var left = $("#left");

        //change to left: "1px" and it works the way you would expect
        right.animate({left: "0px"});
        left.animate({left: ($(window).width() * -1) + "px"});
    }

    function slideRight()
    {
        var right = $("#right");
        var left = $("#left");

        //change to left: "1px" and it works the way you would expect
        left.animate({left: "0px"});
        right.animate({left: $(window).width() + "px"});
    }
</script>
    </head>
    <body>
        <div id="left" onclick='slideLeft()'>&nbsp;</div>
        <div id="right" onclick='slideRight()'>&nbsp;</div>
     </body>
</html>
andersbrohall commented 10 years ago

Same problem here.

Genoil commented 10 years ago

same here. dug into it and line 744 needs to be changed from:

if (stashedProperty) {

to

if (typeof stashedProperty !== 'undefined') {
LekisS commented 10 years ago

same here...

LekisS commented 10 years ago

Your fix worked, thanks @Genoil

benbarnett commented 10 years ago

Thanks @Genoil @LekisS

Genoil commented 10 years ago

Thank YOU instead for this extremely convenient library

Sent from my iPhone

On 8 jul. 2014, at 11:47, Ben Barnett notifications@github.com wrote:

Thanks @Genoil @LekisS

— Reply to this email directly or view it on GitHub.