kritya
kritya

Reputation: 3362

Jquery put a popup until the whole page is loaded

Jquery put a popup until the whole page is loaded and doesn't allows to click outside any help encouraged. Thanks in advance

Upvotes: 1

Views: 977

Answers (2)

Amr Elgarhy
Amr Elgarhy

Reputation: 68912

You can do this without jQuery, also you can write some code using jQuery to just make sure that the page is ready.

You can add a big div in the first lines of your page html:

<head></head>
<html>
 <body>
   <div class="bigFullScreen"></div>
   .......... the rest of the page html
 </body>
</html>

And in javascript:

$(function () {
   $('.bigFullScreen').hide();
});

OR:

 $(document).ready(function () {
   $('.bigFullScreen').hide();
});

The previous html and jQuery will make sure that the big div will appear the first thing and just when all the html of the page is rendered the jQuery function will hide it.

UPDATE: You can also wait untill all the html including all the images get ready: http://amrelgarhy.com/blog/how-to-tell-when-images-have-loaded/

Upvotes: 3

StuperUser
StuperUser

Reputation: 10850

You could look at using a JQuery UI dialog and setting modal to true.

How to remove close button on the jQuery UI dialog? has information on "locking down" the dialog. You'll need to set CloseOnEscape to false too.

Upvotes: 0

Related Questions