From 64bfb447af4c19f9d0a8d3ee0c1933e4504bde83 Mon Sep 17 00:00:00 2001 From: beaubbe Date: Tue, 6 May 2014 12:40:21 -0400 Subject: [PATCH] Added offset calculation when allowWrap = false --- src/jquery.cycle2.carousel.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/jquery.cycle2.carousel.js b/src/jquery.cycle2.carousel.js index cbc48dd7..2484cbb2 100644 --- a/src/jquery.cycle2.carousel.js +++ b/src/jquery.cycle2.carousel.js @@ -131,6 +131,18 @@ $.fn.cycle.transitions.carousel = { offset -= $(tmp[j])[vert?'outerHeight':'outerWidth'](true); } } + } else { + if ( opts.carouselSlideDimension ) { + offset -= ( (opts.slideCount + opts.currSlide) * opts.carouselSlideDimension ); + } else { + // calculate offset based slide dimensions of preceding siblings of active slide + tmp = opts._carouselWrap.children(); + + tmp.filter('.active').prevAll().each(function () { + offset -= ($(this)[vert?'outerHeight':'outerWidth'](true)); + }); + + } } opts._carouselWrap.css( vert ? 'top' : 'left', offset );