> jQuery.extend({
>preloadImage: function(imagePath,callback) {
> var image = new Image();
> if(jQuery.isFunction(callback)) image.onload = callback;
> image.src = "gfx/"+imagePath;
>}
>
> });
Looks good, I'll give it a try.
Thanks a lot!
Eric
I doubt that will work. There need not be anything particularly "jQueryish"
about preloading images, but if you want to stick it under $, maybe
something like:
jQuery.extend({
preloadImage: function(imagePath,callback) {
var image = new Image();
if(jQuery.isFunction(callba
I'm sure there's a more sophisticated way of doing this, but functions can
be passed around like any other variable type in JavaScript, so:
jQuery.extend({
preloadImage: function(imagePath,callback) {
jQuery("").attr("src", "gfx/"+imagePath);
callback();
}
});
Shou
3 matches
Mail list logo