Browse Source

Fix the bug where 'walk' callback was not triggered with 'next' or 'previous' methods.

Jay Salvat 13 years ago
parent
commit
5bbe16857a
1 changed files with 9 additions and 4 deletions
  1. 9 4
      jquery.vegas.js

+ 9 - 4
jquery.vegas.js

@@ -1,7 +1,7 @@
 // ----------------------------------------------------------------------------
 // Vegas - jQuery plugin 
 // Add awesome fullscreen backgrounds to your webpages.
-// v 1.1 beta
+// v 1.x
 // Dual licensed under the MIT and GPL licenses.
 // http://vegas.jaysalvat.com/
 // ----------------------------------------------------------------------------
@@ -35,12 +35,12 @@
         backgrounds = [],
         step = 0,
 		delay = 5000,
+		walk = function() {},
         timer,
         methods = {
 
         // Init plugin
         init : function( settings ) {
-
             var options = {
                 src: getBackground(),
                 align: 'center',
@@ -170,7 +170,7 @@
                 delay: delay,
                 preload: false,
                 backgrounds: backgrounds,
-                walk: function() {}
+                walk: walk
             };
             
             $.extend( options, $.vegas.defaults.slideshow, settings );
@@ -180,6 +180,10 @@
                     options.step = 0;
                 }
 
+                if ( !settings.walk ) {
+                    options.walk = function() {};
+                }
+
                 if ( options.preload ) {
                     $.vegas( 'preload', options.backgrounds );
                 }
@@ -188,6 +192,7 @@
             backgrounds = options.backgrounds;
 			delay = options.delay;
             step = options.step;
+			walk = options.walk;
 
             clearInterval( timer );
 
@@ -210,7 +215,7 @@
                 if ( settings.fade > options.delay ) {
                     settings.fade = options.delay;
                 }
-
+				
                 $.vegas( settings );
             }
             doSlideshow();