"Expand Cards Responsive"
Bootstrap 4.1.1 Snippet by kiskelcsi

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="panel active" style=" background-image: url('https://images.pexels.com/photos/5683079/pexels-photo-5683079.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260'); "> <h3>Oslo</h3> </div> <div class="panel" style=" background-image: url('https://images.pexels.com/photos/3787839/pexels-photo-3787839.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260'); "> <h3>Dubai</h3> </div> <div class="panel" style=" background-image: url('https://images.pexels.com/photos/4452037/pexels-photo-4452037.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260'); "> <h3>Paris</h3> </div> <div class="panel" style=" background-image: url('https://images.pexels.com/photos/1386444/pexels-photo-1386444.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260'); "> <h3>Barcelona</h3> </div> <div class="panel" style=" background-image: url('https://images.pexels.com/photos/4039921/pexels-photo-4039921.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260'); "> <h3>New York</h3> </div> </div> </div>
@import url("https://fonts.googleapis.com/css?family=Muli&display=swap"); * { box-sizing: border-box; } body { font-family: "Muli", sans-serif; display: flex; align-items: center; justify-content: center; height: 140vh; overflow: scroll; margin: 0; } .container { display: flex; width: 90vw; } .panel { background-size: cover; background-position: center; background-repeat: no-repeat; height: 15vh; border-radius: 50px; color: #fff; cursor: pointer; flex: 0.5; margin: 10px; position: relative; -webkit-transition: all 700ms ease-in; } .panel h3 { font-size: 24px; position: absolute; bottom: 20px; left: 20px; margin: 0; opacity: 0; } .panel.active { height: 70vh; } .panel.active h3 { opacity: 1; transition: opacity 0.3s ease-in 0.4s; } @media (min-width: 480px) { body { height: 100vh; } .panel { height: 80vh; } .panel.active { flex: 10; height: 80vh; } } @media (max-width: 480px) { .container { display: block; width: 100vw; flex-direction: column; } .panel: { flex: 1; } }
const panels = document.querySelectorAll('.panel') panels.forEach(panel => { panel.addEventListener('click', () => { removeActiveClasses() panel.classList.add('active') }) }) function removeActiveClasses() { panels.forEach(panel => { panel.classList.remove('active') }) }

Related: See More


Questions / Comments: