Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="card-sliders ">
	<div class="container ">
		<div class="row align-items-center">
			<div class="col">
				<h3>Animated Bootstrap card decks</h3>
				<p class="lead">Using Bootstrap, Animate.css and jQuery</p>
				
				<div class="row mt-5">
					<div class="col">
						<div class="card-decks">
							<div class="card-deck deck-active">
								<div class="card">
								  <img class="card-img" src="https://images.pexels.com/photos/1660995/pexels-photo-1660995.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="Card image">
								  <div class="card-img-overlay">
									 <h5 class="card-title">An awesome title</h5>
									 <p class="card-text">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Provident, maiores.</p>
									 <p class="card-text">
										 Photo taken by
										 <a href="https://www.pexels.com/nl-nl/foto/architectuur-ijsland-toren-vuurtoren-1660995/">Tomáš Malík</a>
									</p>
								  </div>
								</div>
								<div class="card">
							  <img class="card-img" src="https://images.pexels.com/photos/2501968/pexels-photo-2501968.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="Card image">
							  <div class="card-img-overlay">
								 <h5 class="card-title">An awesome title</h5>
								 <p class="card-text">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Provident, maiores.</p>
								 <p class="card-text">
									 Photo taken by
									 <a href="https://www.pexels.com/nl-nl/@jeffrey-czum-254391">Jeffrey Czum</a>
								</p>
							  </div>
							</div>
								<div class="card">
							  <img class="card-img" src="https://images.pexels.com/photos/96932/pexels-photo-96932.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="Card image">
							  <div class="card-img-overlay">
								 <h5 class="card-title">An awesome title</h5>
								 <p class="card-text">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Provident, maiores.</p>
								 <p class="card-text">
									 Photo taken by
									 <a href="https://www.pexels.com/nl-nl/@francesco-ungaro">Francesco Ungaro</a>
								</p>
							  </div>
							</div>
							</div>
							<div class="card-deck">
								<div class="card">
								  <img class="card-img" src="https://images.pexels.com/photos/3715436/pexels-photo-3715436.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="Card image">
								  <div class="card-img-overlay">
									 <h5 class="card-title">An awesome title</h5>
									 <p class="card-text">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Provident, maiores.</p>
									 <p class="card-text">
										 Photo taken by
										 <a href="https://www.pexels.com/nl-nl/@aleksey-kuprikov-1883853">
Aleksey Kuprikov</a>
									</p>
								  </div>
								</div>
								<div class="card">
							  <img class="card-img" src="https://images.pexels.com/photos/1829191/pexels-photo-1829191.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="Card image">
							  <div class="card-img-overlay">
								 <h5 class="card-title">An awesome title</h5>
								 <p class="card-text">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Provident, maiores.</p>
								 <p class="card-text">
									 Photo taken by
									 <a href="https://www.pexels.com/nl-nl/@braydenlaw">Brayden Law</a>
								</p>
							  </div>
							</div>
								<div class="card">
							  <img class="card-img" src="https://images.pexels.com/photos/2096698/pexels-photo-2096698.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="Card image">
							  <div class="card-img-overlay">
								 <h5 class="card-title">An awesome title</h5>
								 <p class="card-text">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Provident, maiores.</p>
								 <p class="card-text">
									 Photo taken by
									 <a href="https://www.pexels.com/nl-nl/@braydenlaw">Brayden Law</a>
								</p>
							  </div>
							</div>
							</div>
						</div>
					</div>

				</div>
			
				
			</div>
		</div>
		
	</div>
</div>

              
            
!

CSS

              
                $extraDark: #181A28;
$dark: #2A2E45;
$light: #343956;
$green: #3BCEAC;



body{
	height:100%;
	background:$dark;
	color:#FFF;
	font-family: "montserrat";

	&:before{
		content: '';
		height:  100%;
		width:   100%;
		background: repeating-linear-gradient(120deg, $light, $light 2px, transparent 2px, transparent 17.5vw);
		position:absolute;
	}
}

.card-sliders{
	overflow:hidden;
	height:95vh;
	
	.container{
		height:100%!important;
		.row{
			height:100%;
		}
	}
	
	.card-decks{
		.card-deck{
			display:none;
			&.deck-active{
				display:flex;
			}
			
			.card{
				font-size: 0.8rem;
				border:0;
				border-radius: 1.25rem;
				box-shadow: 0 10px 20px 2px $extraDark; 
				color: #FFF;			
				
				height: 50vh;
				overflow:hidden;
			
				h1,h2,h3,h4,h5,h6{
					font-weight:bold;
				}
				a{
					color:$green;
				}
				img{
					width:200%;
					height:200%;
					object-fit:cover;
					
					position:absolute;
					top:50%;
					left:50%;
					transform: translate(-50%,-50%);

				}
				.card-img-overlay{
					background: rgba(0,0,0,0.5)
				}
			}
			
		}
	}
	
}

/* Custom animate.css delay */
.animated.delay-02s {
  -webkit-animation-delay: .2s;
  animation-delay: .2s;
}
.animated.delay-04s {
  -webkit-animation-delay: .4s;
  animation-delay: .4s;
}
              
            
!

JS

              
                // The current slide
var slideOrder = 0;

// Pause between slides in miliseconds
var slidePause = 8000;

// The slides array
var slides = $(".card-decks .card-deck");

$(document).ready(function(){
	nextSlide(slideOrder)
})

function autoSlide(){
	autoSlideTimeout = setTimeout(function() {
		
		// Check if the slideOrder is not bigger
		// than the available amount of slides
		if(slides.length <= slideOrder){
			slideOrder = 0;
		}

		// Give us the next slide
		nextSlide(slideOrder);
		
		
		slideOrder++;
	}, slidePause);
}

function theDelay(index){
	// Maybe a bit dirty but we need to get the exact
	// pause between all the slides and we dont want a
	// point in the variable because of css
	var delay = (0.2 * index)
	var delayClass = parseInt(delay.toString().replace(".", ""));
	
	return "0" + delayClass
}

function nextSlide(deck){
	//	Find the current active deck
	var currentDeck = slides.closest(".deck-active")
	var currentCards = currentDeck.find(".card");
	
	// Find the target deck we want to load in
	var nextDeck = slides.eq(deck);
	
	currentCards.each(function(index){
		var delay = theDelay(index);
		var card =$(this)
		// Remove all the animate.css classess
		card.removeClass().attr('class', 'card');

		
		
		card.addClass("animated flipOutY fast delay-" + delay + "s");
		setTimeout(function(){
			card.find(".card-img-overlay").fadeOut();
			card.find(".card-img").removeAttr('style');
		}, ((delay + 8) * 50))
		
		
	});
	
	//	Animate.css class "fast" is timed for 0.8s
	//	we delay each CARD (not card-deck) intro by 0.2s 
	// so 0.8 + 0.2 = 1s
	//
	// 1 times each card without the first one * 1000
	// = the amount of seconds we have to wait before the new
	// we end this function
	//
	// I didn't remove the 1 because of the explanation
	var timeout = ((1 * (currentCards.length - 1)) * 1000)
	
	setTimeout(function(){
		if(nextDeck.length){
			// Hide the current deck so the new deck
			// gets the right position then clean the
			// current deck
			currentDeck.removeClass("deck-active");
			currentDeck.find(".card").each(function(){
				$(this).removeClass().attr('class', 'card');
			})

			nextDeck.find(".card").each(function(index){
				var delay = theDelay(index);
				
				var card = $(this);
				setTimeout(function(){
					card.find(".card-img-overlay").stop().fadeIn();
					card.find(".card-img").animate({height: '110%', width: '110%'}, {duration:(slidePause / 2), easing: 'swing', queue: false });
			
				}, ((delay + 8) * 10))
				card.addClass("animated flipInY fast delay-" + delay + "s");
			
				
				
				
			})
			nextDeck.addClass("deck-active");
			autoSlide();
		}else{
			// Try to reset the process
			console.error("Card flipper, did not find the target deck. Did you remove it?")
			slideOrder = 0;
			autoSlide();
		}
		
	}, timeout)
}
              
            
!
999px

Console