1

I'm trying to create a preloader for my site that would account for all assets, not just binary images and is under 10k in code. Before I try and reinvent the wheel can anyone share their favourrote loading strategies and/or point me to any good, lightweight HTML5 preloaders online?

Came across this jQuery plugin, but I think it is only for images and also for images that are 'below the fold', ie not part of the visible page before scrolling. http://www.appelsiini.net/projects/lazyload

As far as preloading just images, would one approach be to simply use javascript to write out the image tags inside a hidden div?

//the_images is array of images created in your head

//inside hidden div where you want images to appear
<div id="imageDiv" style="display:none;">
<script>
for (var i=0; i<numImages; i++)
        {
            document.write('<img src="' + the_images[i] + '" alt="" class="foo"/>');
        } 
</script>
</div>
4

0 回答 0