YOUTUBE LINK - CLICK HERE
HTML:
<!DOCTYPE html>
<html>
<head>
<title>
Reveal Lines
</title>
<link href="reveal lines.css" rel="stylesheet">
</head>
<body>
<div class="header">
<li><a href="#home">HOME</a></li>
<li><a href="#HTML">HTML</a></li>
<li><a href="#CSS">CSS</a></li>
<li><a href="#JS">JAVASCRIPT</a></li>
</div>
<div class="container">
<div class="items" id="home">
<div class="content">
<h3>HOME</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugit, ratione consequatur. Ducimus aut atque illum excepturi fugit, cumque iste rem blanditiis sint suscipit in libero earum! Fugiat nam optio aperiam.</p>
</div>
</div>
<div class="items" id="HTML">
<div class="content">
<h3>HTML</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugit, ratione consequatur. Ducimus aut atque illum excepturi fugit, cumque iste rem blanditiis sint suscipit in libero earum! Fugiat nam optio aperiam.</p>
</div>
</div>
<div class="items" id="CSS">
<div class="content">
<h3>CSS</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugit, ratione consequatur. Ducimus aut atque illum excepturi fugit, cumque iste rem blanditiis sint suscipit in libero earum! Fugiat nam optio aperiam.</p>
</div>
</div>
<div class="items" id="JS">
<div class="content">
<h3>JAVASCRIPT</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugit, ratione consequatur. Ducimus aut atque illum excepturi fugit, cumque iste rem blanditiis sint suscipit in libero earum! Fugiat nam optio aperiam.</p>
</div>
</div>
</div>
<script>
var elements = document.getElementsByClassName('items');
window.onscroll = function() {
for (let i = 0; i < elements.length; i++) {
if (elements[i].getBoundingClientRect().y <= 100) {
elements[i].children[0].children[1].style.transform = "translateY(0px)";
elements[i].children[0].children[1].style.opacity = 1;
} else {
elements[i].children[0].children[1].style.transform = "translateY(50px)";
elements[i].children[0].children[1].style.opacity = 0;
}
}
}
</script>
</body>
</html>
CSS:
html {
scroll-behavior: smooth;
}
* {
padding: 0px;
margin: 0px;
box-sizing: border-box;
}
.header {
display: flex;
justify-content: space-around;
background-color: black;
box-shadow: 0px 5px grey;
}
.header>li {
list-style: none;
padding: 10px;
color: white;
transition: 1s;
}
a {
text-decoration: none;
color: white;
}
li:hover {
color: white;
background-color: #f70776;
}
.items:nth-child(1) {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: #141010;
color: white;
font-size: 2rem;
}
.items:nth-child(2) {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: #680747;
color: white;
font-size: 2rem;
}
.items:nth-child(3) {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: #c31950;
color: white;
font-size: 2rem;
}
.items:nth-child(4) {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: #f70776;
color: white;
font-size: 2rem;
}
.content {
width: 80%;
}
.content>p {
font-size: 1rem;
transform: translateY(50px);
opacity: 0;
transition: 2s;
}
Post a Comment