Let's see the following example to better understand the concept:
HTML code:
1 |
<body> |
JS code:
Some web site contains a large number of images, scripts or stylesheets even after optimization of various pages. This slow loading, and the end user just does not perhaps understand that the page is being loaded when he sees everywhere broken divs, or images half loaded.
In this small article I will show you a trick that allows you to make a preloading image on your site, which will disappear once the page is loaded, using the Mootools framework.
Let's see the following example to better understand the concept:
1 |
<body> |
Hello, I am Nabyl, a Freelance web developer and a joomla addict. I have made many sites using the latter, but also patches for the core of this CMS. I like HipHop culture and world of warcraft. You can find find me on Twitter when i'm free...
Website: www.coins.ma E-mail: This e-mail address is being protected from spambots. You need JavaScript enabled to view itSorry i was busy.
So can you give a link to your page, just to see how do you do.
hmmm i can not insert code on your page. But your code is not working in joomla index.php....well i can't make it work.
This e-mail address is being protected from spambots. You need JavaScript enabled to view itin the header i pasted this:
window.addEvent('load', function() { $('preloader').destroy(); $('wrap').setStyle('visibility', 'visible'); });
and in the body i pasted this:
end me a index.php page with the code and images by mail as example?
For Joomla, you can use this in your template. First, paste the JS part in the head section of your index.php, and just after the tag, paste the DIV with id "preloader" .
Don't forget to wrap all the content of your template with the DIV "wrap".
You can go to the demo page to see how this trick work.
Where in Joomla should i past this code? In the Template index.php file?
This e-mail address is being protected from spambots. You need JavaScript enabled to view it