From 61ba8a893703ef2beaadff716f6e3b491def6a5e Mon Sep 17 00:00:00 2001 From: Tri Nguyen Date: Mon, 29 Jul 2013 12:30:02 -0400 Subject: [PATCH 1/4] add next prev classes for dynamic container on init --- src/responsive-carousel.dynamic-containers.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/responsive-carousel.dynamic-containers.js b/src/responsive-carousel.dynamic-containers.js index 52ab22e..cd48a21 100644 --- a/src/responsive-carousel.dynamic-containers.js +++ b/src/responsive-carousel.dynamic-containers.js @@ -53,6 +53,7 @@ } $self[ pluginName ]( "update" ) + [ pluginName ]( "_addNextPrevClasses" ) // initialize pagination .trigger( "goto." + pluginName ); From bf25d4d6ffd22cf0416e17ea304c5267038418b3 Mon Sep 17 00:00:00 2001 From: Tri Nguyen Date: Mon, 29 Jul 2013 15:20:46 -0400 Subject: [PATCH 2/4] better cleanup of kids classes --- src/responsive-carousel.dynamic-containers.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/responsive-carousel.dynamic-containers.js b/src/responsive-carousel.dynamic-containers.js index cd48a21..fd98dbb 100644 --- a/src/responsive-carousel.dynamic-containers.js +++ b/src/responsive-carousel.dynamic-containers.js @@ -11,6 +11,8 @@ var pluginName = "carousel", initSelector = "." + pluginName, itemClass = pluginName + "-item", + prevClass = itemClass + "-prev", + nextClass = itemClass + "-next", activeClass = pluginName + "-active", rowAttr = "data-" + pluginName + "-slide", $win = $( window ), @@ -32,7 +34,7 @@ } $kids - .removeClass( itemClass + " " + activeClass ) + .removeClass( itemClass + " " + activeClass + " " + prevClass + " " + nextClass ) .each(function(){ var prev = $( this ).prev(); From 050babf242b8dd07cd033b0236c97552ec8bd73b Mon Sep 17 00:00:00 2001 From: Tri Nguyen Date: Mon, 29 Jul 2013 15:38:03 -0400 Subject: [PATCH 3/4] add active class on update --- src/responsive-carousel.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/responsive-carousel.js b/src/responsive-carousel.js index af811b6..c97ec3a 100644 --- a/src/responsive-carousel.js +++ b/src/responsive-carousel.js @@ -122,7 +122,10 @@ }, update: function(){ - $(this).children().not( "." + navClass ).addClass( itemClass ); + $(this).children().not( "." + navClass ) + .addClass( itemClass ) + .first() + .addClass( activeClass ); return $(this).trigger( "update." + pluginName ); }, From d586c5d11150bb5f96505f172bd300dbe705e36d Mon Sep 17 00:00:00 2001 From: Tri Nguyen Date: Mon, 29 Jul 2013 15:58:19 -0400 Subject: [PATCH 4/4] a simpler way of doing fade transition effect --- src/responsive-carousel.slide.css | 35 ++++++++++++++----------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/src/responsive-carousel.slide.css b/src/responsive-carousel.slide.css index 6ab0614..c2bbc08 100644 --- a/src/responsive-carousel.slide.css +++ b/src/responsive-carousel.slide.css @@ -21,11 +21,6 @@ width: 100%; /* necessary for non-active slides */ display: block; /* overrides basic carousel styles */ z-index: 1; - -webkit-transition: left .2s ease; - -moz-transition: left .2s ease; - -ms-transition: left .2s ease; - -o-transition: left .2s ease; - transition: left .2s ease; } .carousel-no-transition .carousel-item { -webkit-transition: none; @@ -39,23 +34,25 @@ position: relative; z-index: 2; } +.carousel-slide .carousel-item-prev { + left: -100%; +} +.carousel-slide .carousel-out { + left: -100%; + -webkit-transition: left .2s ease; + -moz-transition: left .2s ease; + -ms-transition: left .2s ease; + -o-transition: left .2s ease; + transition: left .2s ease; +} .carousel-slide .carousel-in { left: 0; + -webkit-transition: left .2s ease; + -moz-transition: left .2s ease; + -ms-transition: left .2s ease; + -o-transition: left .2s ease; + transition: left .2s ease; } .carousel-slide-reverse .carousel-out { left: 100%; -} -.carousel-slide .carousel-out, -.carousel-slide-reverse .carousel-in { - left: -100%; -} -.carousel-slide-reverse .carousel-item { - -webkit-transition: left .1s ease; - -moz-transition: left .1s ease; - -ms-transition: left .1s ease; - -o-transition: left .1s ease; - transition: left .1s ease; -} -.carousel-slide-reverse .carousel-active { - left: 0; } \ No newline at end of file