JQuery MultiCallback

 

A Callback() function is executed once the effect is complete. It is always written as the last argument of the method.

Syntax: $(selector).effect_function(speed, callback);

.In this example we are going to use callback function multiple time with the help of slidetToggle() function

 
 
 
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script> <style type="text/css"> h1{ display:none; background:cyan; padding:20px; } p{ background:maroon; font-size: 24px; padding:20px; } </style> <script> $(document).ready(function(){ $("button").click(function(){ $("h1, p").slideToggle("slow", () =>{ alert("The slide toggle effect has completed."); }); }); }); </script> </head> <body> <h1>Hello I am steve jobs</h1> <p style="color: mediumspringgreen">Co- founder of Iphone Company</p> <button type="button">Click me</button> </body> </html>
Output