Tutorial :Slider loading after entire pages loads



Question:

I am using looped slider js for implementing a slider in wordpress. Basically i want to add my slider when entire page loads. please help me. I tried lazyload plugin for that but wont get any success. My markup is like this,

<div class="container">  <div class="slides" >  <div><a><img /></a><a><img /></a></div>  </div>  </div>  

Thanks


Solution:1

You can use Javascript to delay the divisions load time by a few seconds, allowing everything else to load before it. Something like this would do I think.

function changeDivContent() {      var slider = document.getElementById('slides');       var content = "Insert code here to change after delay";           slides.innerHTML = content;  }    function init() {      setTimeout('changeDivContent()', 5000);  }    window.onload = init;  


Solution:2

$(document).ready(function(){ ... });  

fires on page load (HTML is downloaded)

$(window).load(function(){ ... });  

fires when page is ready (images are loaded, etc)


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »