diff --git a/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js b/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js index 566c2b3..90e9dc1 100644 --- a/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js +++ b/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js @@ -16,6 +16,7 @@ settings.targetId = '#' + $(fullId + " :first").attr('id'); settings.slideshowId = settings.targetId.replace('#views_slideshow_cycle_teaser_section_', ''); settings.paused = false; + settings.started = false; settings.opts = { speed:settings.speed, @@ -267,6 +268,12 @@ settings.totalImages = $(settings.targetId + ' img').length; if (settings.totalImages) { settings.loadedImages = 0; + + setTimeout(function() { + if (settings.started == false) { + Drupal.viewsSlideshowCycle.load(fullId); + } + }, settings.wait_for_image_load_timeout); // Add a load event for each image. $(settings.targetId + ' img').each(function() { @@ -297,7 +304,7 @@ // This checks to see if all the images have been loaded. // If they have then it starts the slideshow. Drupal.viewsSlideshowCycle.imageWait = function(fullId) { - if (++Drupal.settings.viewsSlideshowCycle[fullId].loadedImages == Drupal.settings.viewsSlideshowCycle[fullId].totalImages) { + if (++Drupal.settings.viewsSlideshowCycle[fullId].loadedImages == Drupal.settings.viewsSlideshowCycle[fullId].totalImages && Drupal.settings.viewsSlideshowCycle[fullID] == false) { Drupal.viewsSlideshowCycle.load(fullId); } }; @@ -306,6 +313,7 @@ Drupal.viewsSlideshowCycle.load = function (fullId) { var settings = Drupal.settings.viewsSlideshowCycle[fullId]; $(settings.targetId).cycle(settings.opts); + settings.started = true; // Start Paused if (settings.start_paused) { 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 44f9913..8417af7 100644 --- a/contrib/views_slideshow_cycle/views_slideshow_cycle.views_slideshow.inc +++ b/contrib/views_slideshow_cycle/views_slideshow_cycle.views_slideshow.inc @@ -56,6 +56,7 @@ function views_slideshow_cycle_views_slideshow_option_definition() { 'fixed_height' => array('default' => 1), 'items_per_slide' => array('default' => 1), 'wait_for_image_load' => array('default' => 1), + 'wait_for_image_load_timeout' => array('default' => 2000), // Internet Explorer Tweaks 'cleartype' => array('default' => 'true'), @@ -337,6 +338,19 @@ function views_slideshow_cycle_views_slideshow_slideshow_type_form(&$form, &$for ), ), ); + $form['views_slideshow_cycle']['wait_for_image_load_timeout'] = array( + '#type' => 'textfield', + '#title' => t('Image wait timeout.'), + '#default_value' => $view->options['views_slideshow_cycle']['wait_for_image_load_timeout'], + '#description' => t('How long, in milliseconds, to wait before just starting the slideshow.'), + '#size' => 8, + '#states' => array( + 'visible' => array( + ':input[name="style_options[views_slideshow_cycle][action_advanced]"]' => array('checked' => TRUE), + ':input[name="style_options[views_slideshow_cycle][wait_for_image_load]"]' => array('checked' => TRUE), + ), + ), + ); // Need to wrap this so it indents correctly. $form['views_slideshow_cycle']['action_advanced_wrapper_close'] = array(