modified by Mayank

pull/229/head
mayank-0103 6 months ago
parent c92b0bc3a8
commit 66fa8ad6d1

@ -1,31 +1,39 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>Expanding Cards</title>
</head>
<body>
<div class="container">
<div class="panel active" style="background-image: url('https://images.unsplash.com/photo-1558979158-65a1eaa08691?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80')">
<h3>Explore The World</h3>
</div>
<div class="panel" style="background-image: url('https://images.unsplash.com/photo-1572276596237-5db2c3e16c5d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80')">
<h3>Wild Forest</h3>
</div>
<div class="panel" style="background-image: url('https://images.unsplash.com/photo-1507525428034-b723cf961d3e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1353&q=80')">
<h3>Sunny Beach</h3>
</div>
<div class="panel" style="background-image: url('https://images.unsplash.com/photo-1551009175-8a68da93d5f9?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1351&q=80')">
<h3>City on Winter</h3>
</div>
<div class="panel" style="background-image: url('https://images.unsplash.com/photo-1549880338-65ddcdfd017b?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80')">
<h3>Mountains - Clouds</h3>
</div>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>Expanding Cards</title>
</head>
<body>
<div class="container">
<div class="panel active"
style="background-image: url('https://images.unsplash.com/photo-1558979158-65a1eaa08691?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80')">
<h3>Explore The World</h3>
</div>
<div class="panel"
style="background-image: url('https://images.unsplash.com/photo-1572276596237-5db2c3e16c5d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80')">
<h3>Wild Forest</h3>
</div>
<div class="panel"
style="background-image: url('https://images.unsplash.com/photo-1507525428034-b723cf961d3e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1353&q=80')">
<h3>Sunny Beach</h3>
</div>
<div class="panel"
style="background-image: url('https://images.unsplash.com/photo-1551009175-8a68da93d5f9?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1351&q=80')">
<h3>City on Winter</h3>
</div> </div>
<div class="panel"
style="background-image: url('https://images.unsplash.com/photo-1549880338-65ddcdfd017b?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80')">
<h3>Mountains - Clouds</h3>
</div>
</div>
<script src="script.js"></script>
</body>
<script src="script.js"></script> </html>
</body>
</html>

@ -2,13 +2,13 @@ const panels = document.querySelectorAll('.panel')
panels.forEach(panel => { panels.forEach(panel => {
panel.addEventListener('click', () => { panel.addEventListener('click', () => {
removeActiveClasses() removeActiveClasses();
panel.classList.add('active') panel.classList.add('active');
}) })
}) })
function removeActiveClasses() { function removeActiveClasses() {
panels.forEach(panel => { panels.forEach(panel => {
panel.classList.remove('active') panel.classList.remove('active');
}) })
} }

@ -10,6 +10,7 @@ body {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 100vh; height: 100vh;
/* width is 100vw by default*/
overflow: hidden; overflow: hidden;
margin: 0; margin: 0;
} }
@ -25,19 +26,19 @@ body {
background-repeat: no-repeat; background-repeat: no-repeat;
height: 80vh; height: 80vh;
border-radius: 50px; border-radius: 50px;
color: #fff; color: #ffffff;
cursor: pointer; cursor: pointer;
flex: 0.5; flex: 0.5;
margin: 10px; margin: 10px;
position: relative; position: relative;
-webkit-transition: all 700ms ease-in; transition: all 700ms ease-in;
} }
.panel h3 { .panel h3 {
font-size: 24px; font-size: 24px;
position: absolute; position: absolute;
bottom: 20px; bottom: 30px;
left: 20px; left: 30px;
margin: 0; margin: 0;
opacity: 0; opacity: 0;
} }
@ -60,4 +61,4 @@ body {
.panel:nth-of-type(5) { .panel:nth-of-type(5) {
display: none; display: none;
} }
} }
Loading…
Cancel
Save