(function($) { var cache = []; $.preLoadImages = function() { var args_len = arguments.length; for (var i = args_len; i--;) { var cacheImage = document.createElement('img'); cacheImage.src = "/bizdemo119011/img/design/slider"+arguments[i]+".jpg"; cache.push(cacheImage); } } })(jQuery) jQuery.preLoadImages("1","2","3"); (function($) { var cache2 = []; $.preLoadImages2 = function() { var args_len2 = arguments.length; for (var i = args_len2; i--;) { var cacheImage2 = document.createElement('img'); cacheImage2.src = "/default/img/design/slider"+arguments[i]+".jpg"; cache2.push(cacheImage2); } } })(jQuery) jQuery.preLoadImages2("1","2","3");