Day 1: Finshed JS based

This commit is contained in:
2021-04-09 18:39:57 +02:00
parent b591904038
commit 566422ed0d
3 changed files with 139 additions and 0 deletions

61
50Days/day1/index.html Normal file
View File

@@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w=="
crossorigin="anonymous" /> -->
<link rel="stylesheet" href="style.css" />
<title>Day 1 - Expanding Cards</title>
</head>
<body>
<div class="container">
<div
class="panel active"
style="
background-image: url(https://images.unsplash.com/photo-1508672019048-805c876b67e2?w=1350);
"
>
<h3>Explore The World</h3>
</div>
<div
class="panel"
style="
background-image: url(https://images.unsplash.com/photo-1485123263479-f5ea30a2f92d?w=1350);
"
>
<h3>Winter in Sweden</h3>
</div>
<div
class="panel"
style="
background-image: url(https://images.unsplash.com/photo-1585392569893-c33ab1e3f3f5?w=1350);
"
>
<h3>Summer in Australia</h3>
</div>
<div
class="panel"
style="
background-image: url(https://images.unsplash.com/photo-1534430480872-3498386e7856?w=1350);
"
>
<h3>New York</h3>
</div>
<div
class="panel"
style="
background-image: url(https://images.unsplash.com/photo-1552465011-b4e21bf6e79a?w=1350);
"
>
<h3>South East Asia</h3>
</div>
</div>
<script src="script.js"></script>
</body>
</html>

14
50Days/day1/script.js Normal file
View File

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

64
50Days/day1/style.css Normal file
View File

@@ -0,0 +1,64 @@
@import url("https://fonts.googleapis.com/css2?family=Muli&display=swap");
* {
box-sizing: border-box;
}
body {
font-family: "Muli", sans-serif;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
overflow: hidden;
margin: 0;
}
.container {
display: flex;
width: 90vw;
}
.panel {
background-size: auto 100%;
background-position: center;
background-repeat: no-repeat;
height: 80vh;
border-radius: 50px;
color: #fff;
cursor: pointer;
flex: 0.5;
margin: 10px;
position: relative;
transition: flex 0.7s ease-in;
}
.panel h3 {
font-size: 24px;
position: absolute;
bottom: 20px;
left: 20px;
margin: 0;
opacity: 0;
transition: opacity 0.4s ease-in;
}
.panel.active {
flex: 5;
}
.panel.active h3 {
opacity: 0.9;
transition: opacity 0.5s ease-in 0.2s;
}
@media (max-width: 480px) {
.container {
width: 100vw;
}
.panel:nth-of-type(4),
.panel:nth-of-type(5) {
display: none;
}
}