Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

A simpler way to do fade effect #64

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/responsive-carousel.dynamic-containers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ),
Expand All @@ -32,7 +34,7 @@
}

$kids
.removeClass( itemClass + " " + activeClass )
.removeClass( itemClass + " " + activeClass + " " + prevClass + " " + nextClass )
.each(function(){
var prev = $( this ).prev();

Expand All @@ -53,6 +55,7 @@
}

$self[ pluginName ]( "update" )
[ pluginName ]( "_addNextPrevClasses" )
// initialize pagination
.trigger( "goto." + pluginName );

Expand Down
5 changes: 4 additions & 1 deletion src/responsive-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
},
Expand Down
35 changes: 16 additions & 19 deletions src/responsive-carousel.slide.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}