How to stop firing event until an effect is finished in jQuery

  1058 views   2 years ago jQuery

Use the jQuery callback function

You can utilize the jQuery callback function mechanism to stop events from firing until an effect is completely finished, such as doing something after slide animation or fade out transition is fully completed and so on. Let's take a look at an example to see how it works:

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>jQuery Fire Events after an Effect is Over</title>
        height: 300px;
        display: none;        
        background: yellowgreen;
<script src=""></script>
    $(".box").slideDown(3000, function(){
        $(".hint").text("Sliding is completed, now fading out.");
        $(this).fadeOut(3000, function(){
            $(".hint").text("Fading out completed.");
    <div class="box"></div>
    <p class="hint"></p>


Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]