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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <header class="tg-header">
<h1 class="tg-h1">Animate bootstrap columns</h1>
<h2 class="tg-h2">Wait a moment, there is a quick animation</h2>
</header>

<div class="main">
		<div id="btn-toggle" class="btn btn-primary">Show / Hide Filters</div>
		<div class="row main-row">
			<div class="col-4 col-menu">
				<div class="menu-wrap">
					<div class="menu">
						<h6 class="filter-title">Filters</h6>
						<div class="input-group mb-3">
							<div class="input-group-prepend">
								<div class="input-group-text">
									<input type="checkbox" aria-label="Checkbox for following text input">
								</div>
							</div>
							<div class="form-control">Filter 1</div>
						</div>
						<div class="input-group mb-3">
							<div class="input-group-prepend">
								<div class="input-group-text">
									<input type="checkbox" aria-label="Checkbox for following text input">
								</div>
							</div>
							<div class="form-control">Filter 2</div>
						</div>
						<div class="input-group mb-3">
							<div class="input-group-prepend">
								<div class="input-group-text">
									<input type="checkbox" aria-label="Checkbox for following text input">
								</div>
							</div>
							<div class="form-control">Filter 3</div>
						</div>
						<div class="input-group mb-3">
							<div class="input-group-prepend">
								<div class="input-group-text">
									<input type="checkbox" aria-label="Checkbox for following text input">
								</div>
							</div>
							<div class="form-control">(Those filters don't work, it's just a pretext to have a credible interface)</div>
						</div>
					</div>
				</div>
			</div>
			<div class="col-8 col-cards">
				<div class="row row-cards">
					<div class="col-6 col-card">
						<div class="col-card__content">
							<div class="card">
								<img class="card-img-top" src="https://placeimg.com/300/100/any" alt="Card image cap">
								<div class="card-body">
									<h5 class="card-title">No Jquery</h5>
									<p class="card-text">It's only pure Javascript.</p>
								</div>
							</div>
						</div>
					</div>
					<div class="col-6 col-card">
						<div class="col-card__content">
							<div class="card">
								<img class="card-img-top" src="https://placeimg.com/300/100/tech" alt="Card image cap">
								<div class="card-body">
									<h5 class="card-title">CSS Animations</h5>
									<p class="card-text">it uses CSS animations</p>
								</div>
							</div>
						</div>
					</div>
					<div class="col-6 col-card">
						<div class="col-card__content">
							<div class="card">
								<img class="card-img-top" src="https://placeimg.com/300/100/animals" alt="Card image cap">
								<div class="card-body">
									<h5 class="card-title">Just an idea</h5>
									<p class="card-text">This is an exemple. It needs to be improved if you want to use it!</p>
								</div>
							</div>
						</div>
					</div>
					<div class="col-6 col-card">
						<div class="col-card__content">
							<div class="card">
								<img class="card-img-top" src="https://placeimg.com/300/100/architecture" alt="Card image cap">
								<div class="card-body">
									<h5 class="card-title">Some issues</h5>
									<p class="card-text">If you scroll while it's moving, you'll see an issue. There are probably more... I won't fix it but you can try ;)</p>
								</div>
							</div>
						</div>
					</div>
					<div class="col-6 col-card">
						<div class="col-card__content">
							<div class="card">
								<img class="card-img-top" src="https://placeimg.com/300/100/nature" alt="Card image cap">
								<div class="card-body">
									<h5 class="card-title">Card title 4</h5>
									<p class="card-text">This is a long paragraph. Write whatever you want!</p>
								</div>
							</div>
						</div>
					</div>
					<div class="col-6 col-card">
						<div class="col-card__content">
							<div class="card">
								<img class="card-img-top" src="https://placeimg.com/300/100/people" alt="Card image cap">
								<div class="card-body">
									<h5 class="card-title">Card title 5</h5>
									<p class="card-text">This is a long paragraph. Write whatever you want!</p>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

<hr class="tg-hr">
<footer class="tg-footer">
  <a class='tg-link' href='http://timguignard.com' target='_blank'>timguignard.com</a>
  <a class='tg-link' href='https://twitter.com/timguignard' target='_blank'>Twitter</a>
  <a class='tg-link' href='https://dribbble.com/timguignard' target='_blank'>Dribbble</a>
  <a class='tg-link' href='https://www.behance.net/timguignard' target='_blank'>Behance</a>
</footer>
              
            
!

CSS

              
                * {
	box-sizing: border-box;
}
body{
	color: #333!important;
	font-family: "open sans";
	padding: 20px;
	&.no-scroll{
		overflow: hidden;
	}
}

.main{
	padding-left: 40px;	
	padding-right: 40px;	
}
.col-0{
	flex: 0 0 0%;
	max-width: 0%;
}

.filter-title{
	text-transform: uppercase;
	margin-bottom: 20px;
}

.main-row{
	&.no-menu{
		.menu{
			transform: translate3d(-300px, 0, 0);
		}
	}
}
.col-menu{
	.menu-wrap{
		position: relative;
	}
	.menu{
		transition: 1s;
		position: absolute;
		width: 200px;
		left: 0;
		top: 0;
	}
}


.row-cards{
	&.is-moving{
		.card{
			&.clone{
				transition: 1s;
			}
			&:nth-child(1){
				position: absolute;
				width: 100%;
				height: 100%;
				top: 0;
				left: 0;
			}
			&:nth-child(2){	
				opacity: 0;
			}
		}
	}
}
.col-card{
	&__content{
		position: relative;
	}
}
.card{
	padding: 0;
	border: none;
	margin-bottom: 50px;
	box-shadow: 0 2px 14px 0 rgba(47, 60, 83, 0.16);
	.card-body{
		padding: 30px 20px;
	}
	.card-title{
		font-size: 14px;
		font-weight: 700;
		text-transform: uppercase;
	}
	.card-text{
		font-size: 12px;
		line-height: 1.4;
	}
	.card-list{
		font-size: 12px;
		padding-left: 15px;
	}
}

#btn-toggle{
	margin: 0 auto;
	margin-bottom: 20px;
	width: 200px;
	display: block;
	background: rgb(64,191,246);
	background: linear-gradient(90deg, rgba(64,191,246,1) 0%, rgba(110,102,224,1) 100%);
	border: none;
	font-size: 14px;
	padding: 15px;
	font-weight: 300;
	box-shadow: 0 2px 14px 0 rgba(47, 60, 83, 0.3);
}


//==============
//==============
//GLOBAL PRESENTATION, for header and footer
//==============
//==============
html, body{
	padding: 0;
}
body{
  background-color: #f5f6f7;
}
header.tg-header{
	padding: 40px;
	margin-bottom: 40px;
	background: rgb(247,89,100);
background: linear-gradient(90deg, rgba(247,89,100,1) 0%, rgba(249,148,104,1) 100%);
	color: #fff;
}
h1.tg-h1{
  text-align: center;
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
	font-weight: bold;
}
h2.tg-h2{
  text-align: center;
  font-size: 12px;
  letter-spacing: 1.2px;
	font-weight: 300;
}
hr.tg-hr{
  margin: 0 auto;
  margin-top: 30px;
  margin-bottom: 30px;
}
footer.tg-footer{
  text-align: center;
  padding-bottom: 50px;
}

.tg-link{
	display: inline-block;
	margin: 0 20px;
  text-align: center;
  color: #278fb2;
}
//end global

              
            
!

JS

              
                document.addEventListener('DOMContentLoaded', function(){
	let btnToggle = document.querySelector('#btn-toggle');
	let rowCards = document.querySelector('.row-cards');
	let mainRow = document.querySelector('.main-row');
	let colCardAll = document.querySelectorAll('.col-card');
	let cardAll = document.querySelectorAll('.card');

	btnToggle.addEventListener('click', function(){
		if (!rowCards.classList.contains('is-moving')) {
			mainRow.classList.toggle("no-menu");

			for(i=0; i<cardAll.length; i++){
				let clone = cardAll[i].cloneNode(true);
				clone.classList.add("clone");
				cardAll[i].parentElement.insertBefore(clone, cardAll[i]);

				let top = clone.getBoundingClientRect().top;
				let left = clone.getBoundingClientRect().left;
				let width = clone.getBoundingClientRect().width;
				let height = clone.getBoundingClientRect().height;

				
				clone.style.position = 'fixed';
				clone.style.top = top+'px';
				clone.style.left = left+'px';
				clone.style.width = width+'px';
				clone.style.height = height+'px';
			}

			document.querySelector('.col-menu').classList.toggle('col-0');
			document.querySelector('.col-menu').classList.toggle('col-4');
			document.querySelector('.col-cards').classList.toggle('col-8');
			document.querySelector('.col-cards').classList.toggle('col-12');
			for(i=0; i<colCardAll.length; i++){
				colCardAll[i].classList.toggle('col-4');
				colCardAll[i].classList.toggle('col-6');
			}
			rowCards.classList.add('is-moving');

			let cardCloneAll = document.querySelectorAll('.card.clone');
			for(i=0; i<cardCloneAll.length; i++){
				let top = cardAll[i].getBoundingClientRect().top;
				let left = cardAll[i].getBoundingClientRect().left;
				let width = cardAll[i].getBoundingClientRect().width;
				let height = cardAll[i].getBoundingClientRect().height;

				cardCloneAll[i].style.top = top+'px';
				cardCloneAll[i].style.left = left+'px';
				cardCloneAll[i].style.width = width+'px';
				cardCloneAll[i].style.height = height+'px';
			}

			setTimeout(function(){
				rowCards.classList.remove('is-moving');
				for(i=0; i<cardCloneAll.length; i++){
					cardCloneAll[i].remove();
				}
			}, 1000)

		}

	})


	//simulate click for thumbnail 
	setTimeout(function(){
		document.getElementById('btn-toggle').click();
	}, 500);
	setTimeout(function(){
		document.getElementById('btn-toggle').click();
	}, 2500)
})

              
            
!
999px

Console