From 9f082a48a09054246c6eb367c1394f96a56432d7 Mon Sep 17 00:00:00 2001 From: Darrell Brogdon Date: Thu, 25 Jul 2013 13:48:49 -0600 Subject: [PATCH 1/2] Add 'init' option. This patch adds an option named 'init' that accepts a function. When provide this function is called after Cycle has initialized all the elements in a slideshow. --- jquery.cycle.all.js | 4 ++++ jquery.cycle.lite.js | 3 +++ 2 files changed, 7 insertions(+) diff --git a/jquery.cycle.all.js b/jquery.cycle.all.js index dc474ea..3c7dc2a 100644 --- a/jquery.cycle.all.js +++ b/jquery.cycle.all.js @@ -90,6 +90,10 @@ $.fn.cycle = function(options, arg2) { debug('first timeout: ' + startTime); this.cycleTimeout = setTimeout(function(){go(els,opts2,0,!opts.backwards);}, startTime); } + + if (opts.init) { + opts.init(); + } }); }; diff --git a/jquery.cycle.lite.js b/jquery.cycle.lite.js index d22ed39..66908a6 100644 --- a/jquery.cycle.lite.js +++ b/jquery.cycle.lite.js @@ -119,6 +119,9 @@ $.fn.cycle = function(options) { this.cycleTimeout = setTimeout(function() { go(els,opts,0,!opts.rev); }, opts.timeout + (opts.delay||0)); + + if (opts.init) + opts.init(); }); }; From 3ce1321ad1c056ec507f38f4c1516a81ba95770d Mon Sep 17 00:00:00 2001 From: Darrell Brogdon Date: Thu, 25 Jul 2013 13:53:30 -0600 Subject: [PATCH 2/2] Fixed indentation. --- jquery.cycle.lite.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.cycle.lite.js b/jquery.cycle.lite.js index 66908a6..7776f49 100644 --- a/jquery.cycle.lite.js +++ b/jquery.cycle.lite.js @@ -120,8 +120,8 @@ $.fn.cycle = function(options) { go(els,opts,0,!opts.rev); }, opts.timeout + (opts.delay||0)); - if (opts.init) - opts.init(); + if (opts.init) + opts.init(); }); };