SearchRecent posts
The Random ToolboxDrupal 7 Setting up variables for use in a template (preprocess and process functions) Rendering Drupal 7 fields (the right way) Linux Secure Copy (scp) command Restrict Free Shipping in Magento Quickbooks Text Connection Ticket Cross-Site Request Forgery (CSRF) jQuery Events: MouseOver / MouseOut vs. MouseEnter / MouseLeave Monthly archive
|
jQuery animate() Example with Callback FunctionUse a callback function to display a message once the animation is completed. This snippet will animate every html element and then replace the html with the message when the #link-id element is clicked. $("#link-id").click(function() { $("p.animate").animate( {"height": "100px", "width": "250px"}, "slow", function(){ $(this).html("Animation Completed"); }); }); Callback functions are very useful to perform certain activity when the animation is completed. It is also useful from running multiplt animations in a row, each when the previous one has completed. When multiple elements are mapped with the animation and we have specified a callback function, the callback will get called for each of the elements that performed the animation. |