Prevent the user from performing any actions while loading the page

I have a tabbed web application, and I also created image caching before the page goes, so when the user goes to the page, I make all the pictures uploaded to the page.

when I click on the tab with many images, I show the spinner and start downloading the images in the background, after which I will show the page.

but I want to freeze any user inputs or taps while I do this. so what's the best way to freeze and unfreeze an entire page?

thank

+5
source share
4 answers

jQuery jQuery Block UI

, .

<div id="div">
    <h1>Please Wait..</h1>
</div>

jQuery :

$(document).ready(function(){
    $("#div").fadeOut()
  });

- . , .

+12

JQuery :

$("body").find("*").attr("disabled", "disabled");
$("body").find("a").click(function (e) { e.preventDefault(); });

JQuery :

$("body").find("*").removeAttr("disabled");
$("body").find("a").unbind("click");
+1

/ .

, , .

0

:

$(window).bind('load', function() {
    // code here
});

Until the page is fully loaded, this event will not be fired. So, you can call a function that unlocks your page elements.

Enjoy :)

0
source

All Articles