diff --git a/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js b/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js index 496d64d..5e97b1c 100644 --- a/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js +++ b/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js @@ -24,14 +24,27 @@ sync:settings.sync, random:settings.random, nowrap:settings.nowrap, + pause_after_slideshow:settings.pause_after_slideshow, + counter:0, after:function(curr, next, opts) { // Need to do some special handling on first load. - var slideNum = opts.currSlide; + var slideNum = opts.currSlide; if (typeof settings.processedAfter == 'undefined' || !settings.processedAfter) { settings.processedAfter = 1; slideNum = (typeof settings.opts.startingSlide == 'undefined') ? 0 : settings.opts.startingSlide; } Drupal.viewsSlideshow.action({ "action": 'transitionEnd', "slideshowID": settings.slideshowId, "slideNum": slideNum }); + // Custom code to pause the slide show at first slide after running one complete slide show + // Only works with continuous option enabled in view, means nowrap option is disabled. + if(settings.pause_after_slideshow) { + opts.counter = opts.counter + 1; + // debug to see if counter is working fine + // alert(opts.counter); + if (opts.counter == settings.num_divs + 1) { + opts.counter = 1; + Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId, "force": true }); + } + } }, before:function(curr, next, opts) { // Remember last slide. diff --git a/contrib/views_slideshow_cycle/views_slideshow_cycle.views_slideshow.inc b/contrib/views_slideshow_cycle/views_slideshow_cycle.views_slideshow.inc index 012cbf4..adec607 100644 --- a/contrib/views_slideshow_cycle/views_slideshow_cycle.views_slideshow.inc +++ b/contrib/views_slideshow_cycle/views_slideshow_cycle.views_slideshow.inc @@ -307,6 +307,17 @@ function views_slideshow_cycle_views_slideshow_slideshow_type_form(&$form, &$for ), ), ); + $form['views_slideshow_cycle']['pause_after_slideshow'] = array( + '#type' => 'checkbox', + '#title' => t('Pause slideshow and return to first slide after running one slideshow'), + '#default_value' => $view->options['views_slideshow_cycle']['pause_after_slideshow'], + '#description' => t('If selected the slideshow will pause and return to first slide after completeing one slideshow. This option will not work if you are using it with End slideshow after last slide option'), + '#states' => array( + 'visible' => array( + ':input[name="style_options[views_slideshow_cycle][action_advanced]"]' => array('checked' => TRUE), + ), + ), + ); $form['views_slideshow_cycle']['fixed_height'] = array( '#type' => 'checkbox', '#title' => t('Make the slide window height fit the largest slide'),