Loading Please Wait...

Logo Lynxsia IT Solutions

jQuery Effects Callback

JQ Effects Callback

A callback function is executed after the current effect is 100% finished.

jQuery Callback Functions

JavaScript statements are executed line by line. However, with effects, the next line of code can be run even though the effect is not finished. This can create errors.

To prevent this, you can create a callback function.

A callback function is executed after the current effect is finished.

Syntax
					 
        
          $(selector).hide(speed, callback);
        
      

The example below has a callback parameter that is a function that will be executed after the hide effect is completed:

					 
        
          $("button").click(function(){
            $("p").hide("slow", function(){
              alert("The paragraph is now hidden");
            });
          });
        
      

The example below has no callback parameter, and the alert box will be displayed before the hide effect is completed:

					 
        
          $("button").click(function(){
            $("p").hide(1000);
            alert("The paragraph is now hidden");
          });
        
      

How you feel about this blog:

Share this blog on:

Report Us

If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com

Contact Us
Ads
Logo
Lynxsia IT Solutions

We are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..

Kotwali Road, Chhiptehri, Banda, 210001, UP, India

Copyright © 2022, Lynxsia IT Solutions, All rights reserved