Permalink
Browse files

Fixed: using preload with slides that are DIVs or LIs now load properly

  • Loading branch information...
1 parent f1a47d0 commit f90289a98c7d63654ce3edd0ca6dc62d3130e50e @nathansearles nathansearles committed Jul 1, 2011
Showing with 52 additions and 36 deletions.
  1. +13 −9 examples/browser-window/js/slides.js
  2. +13 −9 examples/responsive/js/slides.js
  3. +13 −9 examples/standard/js/slides.js
  4. +13 −9 source/slides.js
@@ -553,7 +553,7 @@
easing: "" // [String] Dependency: jQuery Easing plug-in <http://gsgd.co.uk/sandbox/jquery/easing/>
},
preload: {
- active: true, // [Boolean] Preload the slides before showing them, this needs some work
+ active: false, // [Boolean] Preload the slides before showing them, this needs some work
image: "../img/loading.gif" // [String] Define the path to a load .gif, yes I should do something cooler
},
startAtSlide: 1, // [Number] What should the first slide be?
@@ -641,17 +641,21 @@
backgroundPosition: "50% 50%",
backgroundRepeat: "no-repeat"
});
-*/
-
- this._loadImage( this.slides.eq( this.options.startAtSlide - 1 ).attr("src") ).then( $.proxy(function( url ) {
- this.slidesControl.fadeIn( this.options.fade.interval );
+*/
+ var preloadImage;
+
+ if (this.slides.eq( this.options.startAtSlide - 1 ).is("img")) {
+ preloadImage = this.slides.eq( this.options.startAtSlide - 1 ).attr("src");
+ } else {
+ preloadImage = this.slides.eq( this.options.startAtSlide - 1 ).find("img").attr("src");
+ }
+
+ this._loadImage( preloadImage ).then( $.proxy(function( url ) {
+ this.slidesControl.fadeIn( this.options.fade.interval );
this._trigger( "loaded", this.options.startAtSlide, this );
-
},this));
} else {
- this.slidesControl.fadeIn( this.options.fade.interval, function() {
- this._trigger( "loaded", this.options.startAtSlide, this );
- });
+ this.slidesControl.fadeIn( this.options.fade.interval );
}
if ( this.options.navigation ) {
@@ -553,7 +553,7 @@
easing: "" // [String] Dependency: jQuery Easing plug-in <http://gsgd.co.uk/sandbox/jquery/easing/>
},
preload: {
- active: true, // [Boolean] Preload the slides before showing them, this needs some work
+ active: false, // [Boolean] Preload the slides before showing them, this needs some work
image: "../img/loading.gif" // [String] Define the path to a load .gif, yes I should do something cooler
},
startAtSlide: 1, // [Number] What should the first slide be?
@@ -641,17 +641,21 @@
backgroundPosition: "50% 50%",
backgroundRepeat: "no-repeat"
});
-*/
-
- this._loadImage( this.slides.eq( this.options.startAtSlide - 1 ).attr("src") ).then( $.proxy(function( url ) {
- this.slidesControl.fadeIn( this.options.fade.interval );
+*/
+ var preloadImage;
+
+ if (this.slides.eq( this.options.startAtSlide - 1 ).is("img")) {
+ preloadImage = this.slides.eq( this.options.startAtSlide - 1 ).attr("src");
+ } else {
+ preloadImage = this.slides.eq( this.options.startAtSlide - 1 ).find("img").attr("src");
+ }
+
+ this._loadImage( preloadImage ).then( $.proxy(function( url ) {
+ this.slidesControl.fadeIn( this.options.fade.interval );
this._trigger( "loaded", this.options.startAtSlide, this );
-
},this));
} else {
- this.slidesControl.fadeIn( this.options.fade.interval, function() {
- this._trigger( "loaded", this.options.startAtSlide, this );
- });
+ this.slidesControl.fadeIn( this.options.fade.interval );
}
if ( this.options.navigation ) {
@@ -553,7 +553,7 @@
easing: "" // [String] Dependency: jQuery Easing plug-in <http://gsgd.co.uk/sandbox/jquery/easing/>
},
preload: {
- active: true, // [Boolean] Preload the slides before showing them, this needs some work
+ active: false, // [Boolean] Preload the slides before showing them, this needs some work
image: "../img/loading.gif" // [String] Define the path to a load .gif, yes I should do something cooler
},
startAtSlide: 1, // [Number] What should the first slide be?
@@ -641,17 +641,21 @@
backgroundPosition: "50% 50%",
backgroundRepeat: "no-repeat"
});
-*/
-
- this._loadImage( this.slides.eq( this.options.startAtSlide - 1 ).attr("src") ).then( $.proxy(function( url ) {
- this.slidesControl.fadeIn( this.options.fade.interval );
+*/
+ var preloadImage;
+
+ if (this.slides.eq( this.options.startAtSlide - 1 ).is("img")) {
+ preloadImage = this.slides.eq( this.options.startAtSlide - 1 ).attr("src");
+ } else {
+ preloadImage = this.slides.eq( this.options.startAtSlide - 1 ).find("img").attr("src");
+ }
+
+ this._loadImage( preloadImage ).then( $.proxy(function( url ) {
+ this.slidesControl.fadeIn( this.options.fade.interval );
this._trigger( "loaded", this.options.startAtSlide, this );
-
},this));
} else {
- this.slidesControl.fadeIn( this.options.fade.interval, function() {
- this._trigger( "loaded", this.options.startAtSlide, this );
- });
+ this.slidesControl.fadeIn( this.options.fade.interval );
}
if ( this.options.navigation ) {
View
@@ -553,7 +553,7 @@
easing: "" // [String] Dependency: jQuery Easing plug-in <http://gsgd.co.uk/sandbox/jquery/easing/>
},
preload: {
- active: true, // [Boolean] Preload the slides before showing them, this needs some work
+ active: false, // [Boolean] Preload the slides before showing them, this needs some work
image: "../img/loading.gif" // [String] Define the path to a load .gif, yes I should do something cooler
},
startAtSlide: 1, // [Number] What should the first slide be?
@@ -641,17 +641,21 @@
backgroundPosition: "50% 50%",
backgroundRepeat: "no-repeat"
});
-*/
-
- this._loadImage( this.slides.eq( this.options.startAtSlide - 1 ).attr("src") ).then( $.proxy(function( url ) {
- this.slidesControl.fadeIn( this.options.fade.interval );
+*/
+ var preloadImage;
+
+ if (this.slides.eq( this.options.startAtSlide - 1 ).is("img")) {
+ preloadImage = this.slides.eq( this.options.startAtSlide - 1 ).attr("src");
+ } else {
+ preloadImage = this.slides.eq( this.options.startAtSlide - 1 ).find("img").attr("src");
+ }
+
+ this._loadImage( preloadImage ).then( $.proxy(function( url ) {
+ this.slidesControl.fadeIn( this.options.fade.interval );
this._trigger( "loaded", this.options.startAtSlide, this );
-
},this));
} else {
- this.slidesControl.fadeIn( this.options.fade.interval, function() {
- this._trigger( "loaded", this.options.startAtSlide, this );
- });
+ this.slidesControl.fadeIn( this.options.fade.interval );
}
if ( this.options.navigation ) {

0 comments on commit f90289a

Please sign in to comment.