[jQuery] a simple (fake) preloader with CSS (slideViewer)

[jQuery] a simple (fake) preloader with CSS (slideViewer)


Hi all,
i wasn't able to find a solution for my "plugin": preload an unknown
number of images in a page without writing their path in an array, or
using load vs onload functions or any other (inspiring but too
complicated for my level) snippet of code found right here in the
list.
I was in the train this morning and entering a gallery i had the idea
of making it via CSS alone.
It is a very simple solution, but in my slideViewer do the trick and,
most important, in IE7 too:
http://www.gcmingati.net/wordpress/wp-content/lab/jquery/imagestrip/imageslide-plugin.html
i added a class (CSS) on the div that wraps my list of images saying:
.svw {width: 20px; height: 20px; background: transparent
url(loader.gif) center center no-repeat;}
.svw ul{display: none;}
20px are enough to show a 'loading' or spinning or whatever, gif.
Now, since i call the plugin on "window" load
$(window).bind("load", function() { eccetera...
it is obvious that the plugin "runs" as soon ALL the images have been
downloaded.
And when ALL the images are ready, i simply call .removeClass("swv")
and the gallery (the UL) is now displayed!
It is a FAKE preloader!
It does not preload anything, but it's removed at the right time!
See for yourself:
http://www.gcmingati.net/wordpress/wp-content/lab/jquery/imagestrip/imageslide-plugin.html
(hit F5)
Ciao!
GC
now only remain a last touch and i'll move to a new plugin. ah yes, i
will also work today ;-)