From b16bc38caae3a11d36bd295769fea27203200cdb Mon Sep 17 00:00:00 2001 From: baloneysandwiches Date: Tue, 29 Apr 2014 16:47:12 -0700 Subject: [PATCH 1/2] Use ' }); $(document).on( 'cycle-bootstrap', function( e, opts, API ) { From ab0e81798634c32707f9b61434171c60e804968f Mon Sep 17 00:00:00 2001 From: Alex Bell Date: Thu, 15 May 2014 12:12:52 -0700 Subject: [PATCH 2/2] throttle initAutoHeight triggered by slide-added Without throttling, adding a whole bunch of slides in succession (e.g. with loader) can make the sentinel-selection get glitchy. --- src/jquery.cycle2.autoheight.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/jquery.cycle2.autoheight.js b/src/jquery.cycle2.autoheight.js index f7615a8..ebd003e 100644 --- a/src/jquery.cycle2.autoheight.js +++ b/src/jquery.cycle2.autoheight.js @@ -18,7 +18,6 @@ $(document).on( 'cycle-initialized', function( e, opts ) { return; // bind events - opts.container.on( 'cycle-slide-added cycle-slide-removed', initAutoHeight ); opts.container.on( 'cycle-destroyed', onDestroy ); if ( autoHeight == 'container' ) { @@ -31,15 +30,15 @@ $(document).on( 'cycle-initialized', function( e, opts ) { opts._autoHeightRatio = ratio; } - // if autoHeight is a number then we don't need to recalculate the sentinel - // index on resize + // if autoHeight is calc or ratio then we need to recalculate the sentinel + // index on resize, and also on slide-added/slide-removed if ( t !== 'number' ) { // bind unique resize handler per slideshow (so it can be 'off-ed' in onDestroy) opts._autoHeightOnResize = function () { clearTimeout( resizeThrottle ); resizeThrottle = setTimeout( onResize, 50 ); }; - + opts.container.on( 'cycle-slide-added cycle-slide-removed', opts._autoHeightOnResize ); $(window).on( 'resize orientationchange', opts._autoHeightOnResize ); }