Permalink
Browse files

Added array based paths

Allowed arrays of image paths to be past as a single argument, instead of each image path needing to be it's own string argument. NOTE: Resulted in requiring jQuery 1.3+ and bumped semantic version.
  • Loading branch information...
nerdy-sam committed Sep 21, 2013
1 parent 82db030 commit 1fbbcb1c05c64a852f034cd7b8b43921656c9f7f
Showing with 5 additions and 4 deletions.
  1. +5 −4 jquery.preload.js
View
@@ -1,14 +1,15 @@
/*! Copyright 2011, Ben Lin (http://dreamerslab.com/)
* Licensed under the MIT License (LICENSE.txt).
*
-* Version: 1.0.2
+* Version: 1.1.0
*
-* Requires: jQuery 1.2.3+
+* Requires: jQuery 1.3+
*/
;( function( $ ){
$.preload = function(){
- var tmp = [], i = arguments.length;
+ var imgs = $.isArray(arguments[ 0 ]) ? arguments[ 0 ] : arguments;
+ var tmp = [], i = imgs.length;
// reverse loop run faster
- for( ; i-- ; ) tmp.push( $( '<img />' ).attr( 'src', arguments[ i ]));
+ for( ; i-- ; ) tmp.push( $( '<img />' ).attr( 'src', imgs[ i ]));
};
})( jQuery );

2 comments on commit 1fbbcb1

@ben-lin

This comment has been minimized.

Show comment Hide comment
@ben-lin

ben-lin Dec 11, 2013

Sorry @mitzip I didnt see this. Thanks for the pull request!

Sorry @mitzip I didnt see this. Thanks for the pull request!

@nerdy-sam

This comment has been minimized.

Show comment Hide comment
@nerdy-sam

nerdy-sam Dec 11, 2013

Owner

No worries, glad to contribute! Thanks.

Owner

nerdy-sam replied Dec 11, 2013

No worries, glad to contribute! Thanks.

Please sign in to comment.