day 7 completed

pull/106/head
couldntfindabetterusername 4 years ago
parent 72a8a1cd7d
commit e8c2396fb5

@ -0,0 +1,30 @@
<!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">
<title>07 split landing page</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="grid-item" id="ps-wrapper">
<div class="container" id="ps-container">
<span class="heading">PlayStation 5</span>
<a><span class="btn" id="ps-btn">buy now</span></a>
</div>
</div>
<div class="grid-item" id="xbox-wrapper">
<div class="container" id="xbox-container">
<span class="heading">XBox Series X</span>
<a><span class="btn" id="xbox-btn">buy now</span></a>
</div>
</div>
<script src="script.js"></script>
</body>
</html>

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

@ -0,0 +1,21 @@
const body = document.getElementsByTagName("body")[0];
const gridItem = document.querySelectorAll(".grid-item");
gridItem.forEach((item) => {
item.addEventListener("mouseover", handler);
item.addEventListener("mouseout", removeHandler);
});
function handler(e) {
if (e.target.id === "ps-container") {
body.classList.add("ps-body");
} else if (e.target.id === "xbox-container") {
body.classList.add("xbox-body");
}
}
function removeHandler(e) {
body.classList.remove("ps-body");
body.classList.remove("xbox-body");
}

@ -0,0 +1,76 @@
* {
margin: 0;
padding: 0;
font-family: sans-serif;
transition: all 0.4s linear;
}
body {
display: grid;
grid-template-columns: 50% 50%;
height: 100vh;
transition: all 0.4s ease-in;
}
.ps-body {
grid-template-columns: 70% 30%;
transition: all 0.4s linear;
}
.xbox-body {
grid-template-columns: 30% 70%;
}
.grid-item {
overflow: hidden;
}
#ps-wrapper {
background: url("./ps.jpg") center / cover;
}
#xbox-wrapper {
background: url("./xbox.jpg") center / cover;
}
.container {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #fff;
}
#ps-container {
background: rgba(6, 61, 134, 0.6);
}
#xbox-container {
background: rgba(60, 60, 60, 0.6);
}
.heading {
font-size: 50px;
font-weight: 700;
}
.btn {
padding: 20px 80px;
margin: 50px;
text-transform: uppercase;
border: 3px solid #fff;
display: block;
font-weight: 600;
}
#ps-btn:hover {
background-color: rgb(53, 34, 221);
border-color: rgb(53, 34, 221);
}
#xbox-btn:hover {
background-color: rgb(16, 102, 16);
border-color: rgb(16, 102, 16);
}

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Loading…
Cancel
Save