JAVASCRIPT » Ajax Tutorials

  Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg

Delayed content loading


Delayed content loading

I used this technique on the ipoteka.kz. There's an actual content and relatively "heavy" additional imagery (e.g. the houses at the top).

Additional content, or decorations, can be loaded after the basic content is displayed by "including" an external file with an AJAX call.

Attaching the additional content loading to a window.onload event, lets visitor start the basic content sooner. Inserting HTML from another file, makes separating the markup easy and accessible for a designer.

Prototype javascript library used here.

Note the Event.observe construct; it's the "right" thing to avoid window.onload conflict.


<script src="javascripts/prototype.js" type="text/javascript"></script>

<div id="delayed-content"></div>

<script type="text/javascript">
Event.observe(window,'load',function(){
	new Ajax.Updater('delayed-content','delayed-content.html');
});
</script>

Free   Version: n/a   Platform(s): All   Updated:  July 21, 2008

Developer:Baglan Dosmagambetov Demo Download  
Rated by: 1 user(s)  
Follow Navioo On Twitter

Submit a resource