I am trying to figure out why my loader spinner is not showing.
Here is my CSS code:
.loader {
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: 9999;
background: url(./img/page-loader1.gif) 50% 50% no-repeat rgb(255,255,255);
filter: alpha(opacity=70);
-moz-opacity:0.7;
-khtml-opacity: 0.7;
opacity: 0.7;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
}
In my file called edit.php, I have a datatable that takes about 3-5 seconds to load. I just want to show a spinner while it's loading.
In my HEAD tags, I call my css files and my javascript files:
<head>
<link href="css/bootstrap.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.10.2.js"></script>
Also in the HEAD, I have the javascript function that fades out the load spinner:
<script type="text/javascript">
$(window).load(function() {
$(".loader").fadeOut("slow");
});
</script>
Then, right beneath the opening BODY tag, I have the DIV that calls the loader class:
<div class="loader"></div>
The loader gif, called page-loader1.gif is in a directory called img.
In the css file, I have tried to traverse to the directory just to see if this was the problem:
background: url(./img/page-loader1.gif) 50% 50% no-repeat rgb(255,255,255);
background: url(../img/page-loader1.gif) 50% 50% no-repeat rgb(255,255,255);
background: url(img/page-loader1.gif) 50% 50% no-repeat rgb(255,255,255);
None of these methods seem to work.
I tried to add the word TEST in the DIV tag to see what would happen, and the funny thing is, while the page is loading, the word TEST does indeed appear, and then fades out when the page is finished loading.
That tells me the javascript is doing what it is supposed to do. But I cannot seem to get the DIV tag to display the page-loader1.gif.
Can you see what I might be doing wrong?
Please help.