Witam. Mam taki problem gdzie ustawiłem sobie parallaxe na trzy nakładające się zdjęcia, wysztko działa oprócz jednej rzeczy. Gdy przewijam obraz ze środka diva wraca na górę strony kod poniżej:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Oliwier Rogowski - Portfolio</title>
<meta name="description" content="xxxxxxxxxxxxxxxxxxxx.">
<meta name="keywords" content="słowa, kluczowe, opisujące, zawartość">
<meta name="author" content="xxxxxxx">
<meta http-equiv="X-Ua-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/fontawesome.min.css" integrity="sha384-wESLQ85D6gbsF459vf1CiZ2+rr+CsxRY0RpiF1tLlQpDnAgg6rwdsUF1+Ics2bni" crossorigin="anonymous">
<link rel="stylesheet" href="fontello-50761991/css/fontello.css" type="text/css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="index.js">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<link rel="shortcut icon" href="ogień logo.svg">
</head>
<body>
<header>
<a href="#" class="logo">XXXXXXXXXXXXX</a>
<div class="menu-toggle"></div>
<nav>
<ul>
<li>
<a class="menu" href="#">
<span></span>
<span></span>
<span></span>
<span></span>
Home
</a>
</li>
<li>
<a class="menu" href="#">
<span></span>
<span></span>
<span></span>
<span></span>
About
</a>
</li>
<li>
<a class="menu" href="#">
<span></span>
<span></span>
<span></span>
<span></span>
Portfolio
</a>
</li>
<li>
<a class="menu" href="#">
<span></span>
<span></span>
<span></span>
<span></span>
Contact
</a>
</li>
<li>
<a class="menu" href="#">
<span></span>
<span></span>
<span></span>
<span></span>
Comment
</a>
</li>
<li>
<a class="menu" href="#">
<span></span>
<span></span>
<span></span>
<span></span>
Media
</a>
</li>
</ul>
</nav>
</header>
<section>
<div class="container">
<div class="card">
<div class="content">
<h2 class="web">
WEB
</h2>
<h3 class="developer">
DEVELOPER
</h3>
<p>
Hi I'm xxx and i'm web developer
</p>
<a class="button" href="#">explore</a>
</div>
</div>
</div>
<div class="paralax">
<img id="third" src="three.png">
<img id="second" src="two.png">
<img id="first" src="one.png">
</div>
</section>
<script>
let first = document.getElementById('first');
let second = document.getElementById('second');
let third = document.getElementById('third');
window.addEventListener('scroll', function(){
let value = window.scrollY;
third.style.top = value * 1.25 + 'px';
second.style.top = value * 1.30 + 'px';
first.style.top = value * 1.40 + 'px';
})
</script>
</body>
</html>
*
{
margin: 0 0 0 0;
padding: 0 0 0 0;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
}
body{
min-height:100vh;
margin: 0;
padding: 0;
}
header
{
position: fixed;
top: 0;
left: 0;
width:100%;
display: flex;
justify-content:space-between;
align-items:center;
transition: 0.6s;
padding: 30px 100px;
box-sizing: border-box;
z-index: 1000000;
}
header .logo
{
position: relative;
font-weight: 700;
color: white;
text-decoration: none;
font-size: 2em;
text-transform: uppercase;
letter-spacing: 2px;
transition: 0.6s;
}
nav
{
float:left;
}
header nav ul
{
position:relative;
display: flex;
justify-content: center;
align-items: center;
}
header nav ul li
{
position: relative;
list-style: none;
}
header nav ul li a
{
position:relative;
display: inline-block;
padding: 15px 30px;
color: white;
text-transform: uppercase;
letter-spacing: 4px;
text-decoration: none;
font-size: 10px;
overflow: hidden;
transition: 0.2s;
}
a.menu:hover
{
color: #255784;
background: #2196f3;
box-shadow: 0 0 10px #2196f3, 0 0 40px #2196f3, 0 0 80px #2196f3;
transition-delay:0.5s;
}
header nav ul li a span
{
position: absolute;
display: block
}
header nav ul li a span:nth-child(1)
{
top: 0;
left: -100%;
width:100%;
height: 2px;
background: linear-gradient(90deg, transparent, #2196f3);
}
header nav ul li a:hover span:nth-child(1)
{
left: 100%;
transition:2s;
}
header nav ul li a span:nth-child(2)
{
top: -100%;
right: 0%;
width:2px;;
height:100%;
background: linear-gradient(180deg, transparent, #2196f3);
}
header nav ul li a:hover span:nth-child(2)
{
top: 100%;
transition:2s;
}
header nav ul li a span:nth-child(3)
{
bottom: 0;
right: -100%;
width:100%;
height: 2px;
background: linear-gradient(270deg, transparent, #2196f3);
}
header nav ul li a:hover span:nth-child(3)
{
right: 100%;
transition:2s;
}
header nav ul li a span:nth-child(4)
{
bottom: -100%;
left: 0%;
width:2px;;
height:100%;
background: linear-gradient(360deg, transparent, #2196f3);
}
header nav ul li a:hover span:nth-child(4)
{
bottom: 100%;
transition:2s;
}
section
{
background: linear-gradient( 315deg, #45108A 10%, #3D065F 20%, #10054D 80%);
height:100vh;
display:flex;
justify-content: center;
align-items: center;
}
section::before
{
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(#f00, #f0f);
clip-path: circle(20% at right 70%);
}
section::after
{
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(#2196f3, #e91e63);
clip-path: circle(20% at 10% 10%);
}
section div.container
{
width: 50%;
height: 100vh;
float:left;
position: relative;
z-index: 1;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
}
section div.container
{
position: relative;
background: rgba(255, 255, 255, 0.05);
box-shadow: 0 15px 35px rgba(0,0,0,0.2);
display:flex;
justify-content: center;
align-items: center;
backdrop-filter: blur(10px);
}
.web
{
color: white;
font-size:80px;
font-weight: 700;
}
.developer
{
color: white;
font-size:60px;
font-weight: 500;
}
div.paralax
{
width:50%;
position:relative;
padding: 100px;
height: 100vh;
align-items: center;
display: flex;
justify-content: center;
z-index: 100
}
div.paralax img
{
position: absolute;
align-items: center;
object-fit: cover;
display: flex;
justify-content: center;
overflow:hidden;
}