Basit paralaks kaydırma efekti
<style>
.parallax-container {
height: 400px;
overflow: hidden;
position: relative;
}
.parallax-bg {
background-image: url("https://source.unsplash.com/random/1200x800?nature");
height: 150%;
width: 100%;
position: absolute;
top: 0;
left: 0;
background-size: cover;
background-position: center;
z-index: -1;
}
.parallax-content {
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: white;
text-align: center;
padding: 0 20px;
text-shadow: 2px 2px 5px rgba(0,0,0,0.5);
}
.parallax-content h2 {
font-size: 3rem;
margin-bottom: 20px;
}
.parallax-content p {
font-size: 1.2rem;
max-width: 600px;
}
</style>
<div class="parallax-container">
<div class="parallax-bg" id="parallax-bg"></div>
<div class="parallax-content">
<h2>Paralaks Efekti</h2>
<p>Sayfanızda derinlik hissi yaratmak için bu basit paralaks efektini kullanabilirsiniz.</p>
</div>
</div>
<script>
window.addEventListener("scroll", function() {
const parallaxBg = document.getElementById("parallax-bg");
let offset = window.pageYOffset;
parallaxBg.style.transform = "translateY(" + offset * 0.5 + "px)";
});
</script>
<head>
bölümüne CSS kodlarını ekleyin</body>
etiketinden önce ekleyin