This is a Adventure web
<!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>Adventure web</title>
<style>
@import url('https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700,800,900,=&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Rancho&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'poppins', sans-serif;
}
body {
overflow-x: hidden;
background: #fff;
min-height: 100vh;
}
#header {
position: absolute;
top: 0;
left: 0;
width: 100%;
padding: 30px, 100px;
display: flex;
justify-content: space-between;
align-items: center;
z-index: 1000;
}
#header .logo {
color: #094b65;
font-weight: 700;
font-size: 2em;
text-decoration: none;
}
#header ul {
display: flex;
justify-content: center;
align-items: center;
}
#header ul li {
list-style: none;
margin-left: 20px;
}
#header ul li a {
text-decoration: none;
padding: 6px 15px;
color: #094b65;
border-radius: 20px;
}
#header ul li a:hover,
#header ul li a.active {
background: #094b65;
color: #fff;
}
section::before{
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100px;
background: linear-gradient(to top #094b65,transparent);
z-index: 10;
}
section img{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
pointer-events: none;
}
section {
position: relative;
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
section #text {
position: absolute;
color: #094b65;
font-size: 10vw;
text-align: center;
line-height: 0.55em;
font-family: 'Rancho', cursive;
transform: translateY(-50%);
}
section #text span {
font-size: 0.20em;
letter-spacing: 2px;
font-weight: 400px;
font-family: 'Poppins', sans-serif;
}
#btn {
text-decoration: none;
display: inline-block;
padding: 8px 30px;
background: #fff;
color: #094b65;
font-size: 1.2em;
font-weight: 500;
letter-spacing: 2px;
border-radius: 40px;
transform: translateY(100px);
}
.sec {
position: relative;
padding: 100px;
background: #094b65;
}
.sec h2 {
font-size: 3.5em;
color: #f78;
margin-bottom: 10px;
}
.sec p {
font-size: 1em;
color: #fff;
}
</style>
</head>
<body>
<header id="header">
<a href="#" class="logo">Jungle</a>
<ul>
<li><a href="#" class="active">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Destination</a></li>
<li><a href="#">Contact us</a></li>
</ul>
</header>
<section>
<h2 id="text"><span>Its time to take for a new</span><br>Adventure</h2>
<img src="bird1.png" alt="there is a bird" id="bird1">
<img src="bird2.png" alt="there is a bird" id="bird2">
<img src="forest.png" alt="there is a bird" id="forest">
<!-- <img src="bird1.png" alt="there is a bird" id="bird1">
<img src="bird1.png" alt="there is a bird" id="bird1"> -->
<a href="#" id="btn">Expolre</a>
<img src="rocks.png" alt="rocks" id="rocks">
<img src="water.png" alt="water" id="water">
</section>
<div class="sec">
<h2>Parallax Scrolling Effect</h2>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Eligendi, ullam vero.</p>
</div>
<script>
let text = document.getElementById('text')
let bird1 = document.getElementById('bird1');
let bird2 = document.getElementById('bird2');
let btn = document.getElementById('btn');
let rocks = document.getElementById('rocks');
let forest = document.getElementById('forest');
let water = document.getElementById('water');
let header = document.getElementById('header');
window.addEventListener('scroll',function(){
let value = window.scrollY;
text.style.top =50 +value * -0.1 + '%';
bird1.style.top = value * -2.0 + 'px';
bird1.style.left = value * 3 +'px';
bird2.style.top = value * 1.5 + 'px';
bird2.style.left = value * -5 + 'px';
btn.style.marginTop = value * 1.5 + 'px';
rocks.style.top = value * -0.20 + 'px';
})
</script>
</body>
</html>a
Comments
Post a Comment