Click to toggle dark text on white
Callbacks are very important to jQuery animation because it determines what will happen after the animation is complete. Animation is a timed event, so for reasons of sanity, we shouldn't have to write separate timers to determine what should happen next:
$(document).ready(function() {
$("#clickhere").click(function() {
$("#animate1").animate({
height: "12px",
width: "50px"
}, 1000, function() {
alert('done!');
});
});
});
The callback is always the last argument to jQuery.animate(), and always takes the form of a function.
Privacy Policy | Click Here | jQuery Plugins by Wayfarer | Freelance Jobs Available | Random JavaScript Code Samples | Share a Random Link | JavaScript Jobs