Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Full Screen Loading Panel

0.00/5 (No votes)
19 Mar 2011 1  
After few projects, finally come out with this simple loading panel scripts. Hope it useful for your.JavaScripts  function ShowLoading() {

This articles was originally at wiki.asp.net but has now been given a new home on CodeProject. Editing rights for this article has been set at Bronze or above, so please go in and edit and update this article to keep it fresh and relevant.

After few projects, finally come out with this simple loading panel scripts. Hope it useful for your.

JavaScripts 

 function ShowLoading() {

 
    function GetWidth() {
        var x = 0;
        if (self.innerWidth) {
            x = self.innerWidth;
        }
        else if (document.documentElement && document.documentElement.clientWidth) {
            x = document.documentElement.clientWidth;
        }
        else if (document.body) {
            x = document.body.clientWidth;
        }
        return x;
    };
 
    function GetHeight() {
        var y = 0;
        if (self.innerHeight) {
            y = self.innerHeight;
        }
        else if (document.documentElement && document.documentElement.clientHeight) {
            y = document.documentElement.clientHeight;
        }
        else if (document.body) {
            y = document.body.clientHeight;
        }
        return y;
    };
 
    $("body").append("<div class='LsnLoadingPanelFade'></div><img style='top:" + (GetHeight() / 2).toString() + "px; left:" + (GetWidth() / 2).toString() + "px' class='LsnLoadingPanel'/>");
};
 
function HideLoading() {
    $(".LsnLoadingPanelFade").remove();
    $(".LsnLoadingPanel").remove();
};
 Css Class
.LsnLoadingPanelFade 
{
 	positionfixed;
	width100%;
	height100%;
	top0;
	left0;
	z-index:99999;
}
 
.LsnLoadingPanel 
{
	positionfixed;
	z-index:100000;
	background-image:url('../Images/Loading.gif');
	width:106px;
	height:54px
} 

   These sample scripts must work together with jQuery. E.g.

<head runat="server">
    <title></title>
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/Scripts/jquery-1.4.1.min.js"></script>
</head>
So that, your can simply inject below script and a full screen loading panel will poped up. Enjoy & happy coding.
ShowLoading();

 

 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here