Search code examples
jqueryuser-interfacejquery-animateeasing

Problem with jQuery easing / animate


this works:

function prodLanding(){
$("#productsLanding").animate({opacity: 'toggle', width: 'toggle'}, function(){
$("#productsAll").show('slide', {direction: 'left'}, 800);
});
}

$("#prodLandSelect .prod1").click(function(){
$('#product1').load('products/chicken-jerky/index.html', function() {
prodLanding();
});
return false;
});

But this does not:

    function prodLanding(){
    $("#productsLanding").animate({ left: 200 }, {duration: 'slow', easing: 'easeOutElastic'}, function(){ $("#productsAll").show('slide', {direction: 'left'}, 800);});
    }

    $("#prodLandSelect .prod1").click(function(){
    $('#product1').load('products/chicken-jerky/index.html', function() {
    prodLanding();
    });
    return false;
    });

Any ideas what I am doing wrong?


Solution

  • Looks like you're passing the parameters incorrectly.

    Try:

    $("#productsLanding").animate({ left: 200 }, 'slow', 'easeOutElastic'}, function(){         
    }
    

    http://api.jquery.com/animate/

    .animate( properties, [duration,] [easing,] [complete] )
    properties: A map of CSS properties that the animation will move toward.
    duration: A string or number determining how long the animation will run.
    easing: A string indicating which easing function to use for the transition.
    complete: A function to call once the animation is complete.