Greg
Greg

Reputation: 3063

JS animate - something wrong with my syntax

Could you pls let me know what is wrong with my syntax?

This works:

$("#grow").animate({height: "500px"}, "slow");

But this doesn't work:

$("#grow").animate({height: "500px"}, {duration: "3000", easing:"easein"});

Thanks;

Upvotes: 0

Views: 46

Answers (4)

TheDBomb
TheDBomb

Reputation: 53

First, make sure you have both jQuery AND jQueryUI as easing comes from jQueryUI.

http://api.jqueryui.com/easings/

Then try this:

$("#grow").animate({height: "500px"}, {duration: 3000, easing: "easeInQuad"});

Upvotes: 1

Rik
Rik

Reputation: 308

easing is not a default option swing and linear are.

$("#grow").animate({height: "500px"}, {duration: "3000", easing:"swing"});

You can use a plugin to get more easing options: https://github.com/gdsmith/jquery.easing

Upvotes: 2

Anton Melnikov
Anton Melnikov

Reputation: 1058

$("#grow").animate({height: "500px"}, 3000, "easein"});

Upvotes: 1

Adam Merrifield
Adam Merrifield

Reputation: 10407

Your second parameter shouldn't be an object, but 2 separate parameters as shown in the jQuery animate docs

$("#grow").animate({height: "500px"}, "3000", "easein");

Upvotes: 3

Related Questions