Pages

jQuery Wait, Loading animation

When any type of jQuery process fire show waiting screen . You copy this code in Master page or your web page only. And show output.

Example :


<div class="WaitScreen">
</div>
<style type="text/css">
        .WaitScreen {
            display: none;
            position: fixed;
            z-index: 100000;
            top: 0;
            left: 0;
            height: 100%;
            width: 100%;
            background: rgba( 255, 255, 255, .4 ) url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQFEgxZRlEBM1TGgRTuKM_JPGnpR5iLi5YBVkIIP5zZz2SGCC0LQlEqnZXQWf1SiUEH9MI_d7MO29ztECollKuylzSdlpeRnG34GZJXGxo45Gho0JfRiGu8UwWlQrnjmH0Efp1R-XM4V8L/s1600/loading.gif') 50% 50% no-repeat;
        }
       

        body.loading {
            overflow: hidden;
        }

        body.loading .WaitScreen {
                display: block;
        }
    </style>
    <script type="text/javascript">

        $body = $("body");

        $(document).on({
            ajaxStart: function () { $body.addClass("loading"); },
            ajaxStop: function () { $body.removeClass("loading"); }
        });


    </script>

3 comments:

  1. What's up all, here every one is sharing such experience, thus it's pleasant to
    read this website, and I used to visit this blog every day.

    ReplyDelete
  2. Hi there, just became alert to your blog through Google,
    and found that it is really informative. I am gonna watch out for brussels.

    I will appreciate if you continue this in future. A lot of people will be benefited from
    your writing. Cheers!

    ReplyDelete