/** * -------------------------------------------------------------------- * jQuery-Plugin "preloadCssImages" * by Scott Jehl, scott@filamentgroup.com * http://www.filamentgroup.com * reference article: http://www.filamentgroup.com/lab/automated_image_preloading/ * demo page: http://www.filamentgroup.com/examples/preloadImages/ * * Copyright (c) 2008 Filament Group, Inc * Dual licensed under the MIT (filamentgroup.com/examples/mit-license.txt) and GPL (filamentgroup.com/examples/gpl-license.txt) licenses. * * Version: 1.0, 31.05.2007 * Changelog: * 02.20.2008 initial Version 1.0 * -------------------------------------------------------------------- */ $.preloadCssImages = function(settings){ //overrideable defaults settings = jQuery.extend({ imgDir: 'images' }, settings); //dump all the css rules into one string var sheets = document.styleSheets; var cssPile = ''; for(var i = 0; i0 && imgUrls != ''){//loop array var arr = jQuery.makeArray(imgUrls);//create array from regex obj $(arr).each(function(k){ allImgs[k] = new Image(); //new img obj allImgs[k].src = settings.imgDir +'/'+ this; }); } return allImgs; }