I’m trying to display a loading image on my website but it only works for two separate pages. I use the following Jquery bellow to display the loading image and hide the content while everything is loading, then display the content when it’s finished loading.
This works for only two pages but it doesn’t work for the rest. I checked the code more than 10 times and even switched the order external files are aligned in my HTML code to see if it would work but nothing :P. I also examined everything of the working pages and duplicated it for the non-working and still nothing.
Are there any common mistakes that would cause the code above to not work?
I know what you mean, but the script you posted above HIDES the spinner (and shows the content) once the page is done loading, so that doesn’t help us to see why it doesn’t show before the page is done loading in the first place.
@senff the spinner is suppose to be seen once the page appears on the users screen. and the body has display:none;. The Jquery code hides the spinner only after everything has finished loading, and shows the body after loading is complete.
I know that, but the part of your code above only relates to HIDING the spinner after everything has finished loading. It has nothing to do with the way the spinner is being shown in the first place, so it’s impossible for us to tell why it doesn’t.
Isn’t it just a “problem” that the “Loading” image is just not shown because the page loads (too) fast? Keep in mind that the image itself also needs time to load, so if it’s still loading when the rest of the page is done loading, then you won’t see it of course.
I also see it for “About Me”. especially when i empty the cache. But it shows the images loading. it’s not supposed to do that. Everything loads first, then the content is displayed. And for the “Completed Projects” it doesn’t display at all. I also slowed down the disappear and appearance of the pages to 10seconds(slow motion). And it actually was functioning. I could see the loading image disappear and the content appearing for 10 seconds. But when its at 0 seconds it doesn’t seem to work.
I also found out something new. If i slow down the process to 5 seconds you can see that for “drawings” and “themes” the images simply pop into view without sliding in like the rest. But for the non-working pages everything slides in from the left. http://reallycoolstuff.net/PROJECTS/harol/index.html
any particular reason why that’s happening?