Asked 7 years ago
14 Jan 2017
Views 1969
yogi

yogi posted

load html page in current html page after specific time delay after page load by JavaScript



Page Load Sequence :: header and footer should be load at first
but first middle view part should be load after 2 second
and second middle view part should be load after 4 second
and third middle view part should be load after 5 second

so is that possible to load page like in sequence after some second delay.
its JavaScript which help to load view part after some delay ?
Rasi

Rasi
answered Nov 30 '-1 00:00

You can use ajax with setTimeOut function


<script>
window.onload=function(){
    setTimeout(function(){
 ajaxCall()
    }, 2000);
};
function ajaxCall(){
$("#first-middle").load("first_middle.html");    
setTimeout(function(){
 ajaxCall2()
    }, 4000);

}

function ajaxCall2(){
$("#second-middle").load("second_middle.html");    
setTimeout(function(){
 ajaxCall3()
    }, 1000);

}
function ajaxCall3(){
$("#third-middle").load("third_middle.html");    
 }
</script>


window.load --------->trigger when page load finish --------> setTimeout for 2sec (2000 milisecond ) ------>call ajax which load first middle view part --------> so on..

fyi , window.load = document.load = document.ready - jassy  
Jan 14 '17 03:33
Post Answer