Is it possible to define a string of animations as a variable?
For example (this is what I think, but doesn’t work?):
var speed = 500;
var dothis = $("#div").slideUp('speed');
$("#div").slideDown('speed');
$("#div").animate({ height: "0px" }, 'speed');
$("button").click(function () {
$(this).dothis();
});
I’m not totally sure how to set it up.
It looks like you’re trying to execute a series of actions at a later time… in which case you can just encapsulate all your commands in a function:
And then later you can do all the commands at once by invoking the function: