How to make preloader execute on image load in javascript for wordpress site

The first images of my slider are loading after page load. I want the page viewed with the first slides displayed. I have written a function that creates a div overlay that hides the page initially. I need a function (can be in Jquery) that will hide the div overlay when triggered by an event that will result in the hiding of the div overlay when the first images of my slider are displayed. Site in question: applaudvideo.com password: goonies

Javascript (this is in the header.php of my WP site. It creates the div that hides the page.)

Read More
if (document.getElementById) {
document.write('<style type="text/css" media="screen">#overlay 
{display:block;height:100%;width:100%;background:#2E0854;position:fixed;z-index:99999}
</style>');
}

CSS: (in body)

<div id=overlay></div>

The above function works. I just need a function that will hide the div overlay by binding or listening to an event. The function would be triggered, hide the overlay div, and the slider’s images would already be rendered/displayed.

The following are functions I think I can bind or listen or attach to to hide the div overlay:

Copy and Paste the Below listed API Functions into your Functions for Event Listening.

revapi10.bind("revolution.slide.onloaded",function (e) {
//alert("slider loaded");

});

revapi10.bind("revolution.slide.onbeforeswap",function (e) {
//alert("before swap");

});

revapi10.bind("revolution.slide.onchange",function (e,data) {
//alert("slide changed to: "+data.slideIndex);

Related posts

Leave a Reply