Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to load an entire web page before rendering it?

Tags:

html

ajax

I've got a web page that automatically reloads every few seconds and displays a different random image. When it reloads, however, there is a blank page for a second, then the image slowly loads. I'd like to continue to show the original page until the next page is loaded into the browser's memory and then display it all at once so that it looks like a seamless slideshow. Is there a way to do this?

like image 752
Brian Avatar asked Dec 01 '22 08:12

Brian


1 Answers

is the only thing changing the image? if so it might be more efficient to use something like the cycle plugin for jQuery instead of reloading your whole page.

http://malsup.com/jquery/cycle/

Here is the JS needed if you used jQuery -

Say this was your HTML:

<div class="pics"> 
    <img src="images/beach1.jpg" width="200" height="200" /> 
    <img src="images/beach2.jpg" width="200" height="200" /> 
    <img src="images/beach3.jpg" width="200" height="200" /> 
</div> 

Here would be the needed jQuery:

$(function(){
$('div.pics').cycle();
});

no need to worry about different browsers- complete cross browser compatibility.

like image 199
Slee Avatar answered Dec 04 '22 05:12

Slee