Dzień dobry,
Proszę o pomoc, bo siedzę już nad tym bardzo długo i nie mogę dojść do ładu...
Mam taki kod jak poniżej. W tej chwili są tam zdjęcia (w tle), ale docelowo chciałbym aby w tle pojawiło się wideo. Tak znam zagrożenia związane z działaniem strony itd. Chciałbym aby wideo zachowywało się dokładnie tak jak te obrazy, aby pokazywało się nieruchomo spod elementu poprzedzającego. Gotowe rozwiązanie znajduje się pod tym adresem - https://www.noahdemeuldre.com/. Jeżeli coś jest niejasne to proszę o pytania a dopowiem co potrzeba.
<!DOCTYPE html>
<html lang="pl">
<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">
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
section {
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative;
}
#home {
background-image: url('https://gimpdlazielonych.pl/wp-content/uploads/2020/06/jak-zdjecie-w-tle-wyrozniajacy.webp');
background-repeat: no-repeat;
background-position: center center;
background-attachment: fixed;
background-size: cover;
}
#o-mnie {
background-image: url('https://picsum.photos/id/870/2000/1000');
background-repeat: no-repeat;
background-position: center center;
background-attachment: fixed;
background-size: cover;
}
#uslugi {
background-image: url('https://picsum.photos/id/237/2000/1000');
background-repeat: no-repeat;
background-position: center center;
background-attachment: fixed;
background-size: cover;
}
#portfolio {
background-image: url('https://picsum.photos/id/1018/2000/1000');
background-repeat: no-repeat;
background-position: center center;
background-attachment: fixed;
background-size: cover;
}
#wspolpraca {
background-image: url('https://picsum.photos/id/870/2000/1000');
background-repeat: no-repeat;
background-position: center center;
background-attachment: fixed;
background-size: cover;
}
#kontakt {
background-image: url('https://picsum.photos/id/1027/2000/1000');
background-repeat: no-repeat;
background-position: center center;
background-attachment: fixed;
background-size: cover;
}
.section-container {
color: #fff;
}
nav {
position: fixed;
top: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 6;
}
.menu {
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 auto;
max-width: 1200px;
padding: 20px;
}
.nav-menu {
list-style: none;
display: flex;
}
.nav-menu-item {
margin-left: 20px;
font-size: 18px;
}
.nav-menu-item a {
color: #fff;
text-decoration: none;
padding: 10px;
}
.nav-menu-item:hover:before,
.nav-menu-item.active:before {
content: '';
display: block;
width: 100%;
height: 3px;
background-color: #fff;
position: relative;
bottom: 10px;
}
</style>
<title>Laskar</title>
</head>
<body>
<!-- <nav>
<div class="menu">
<ul class="nav-menu">
<li class="nav-menu-item active"><a href="#home">HOME</a></li>
<li class="nav-menu-item"><a href="#o-mnie">O MNIE</a></li>
<li class="nav-menu-item"><a href="#uslugi">USŁUGI</a></li>
<li class="nav-menu-item"><a href="#portfolio">PORTFOLIO</a></li>
<li class="nav-menu-item"><a href="#wspolpraca">WSPÓŁPRACA</a></li>
<li class="nav-menu-item"><a href="#kontakt">KONTAKT</a></li>
</ul>
</div>
</nav> -->
<script>
const links = document.querySelectorAll('.nav-menu-item a');
for (const link of links) {
link.addEventListener('click', scrollToSection);
}
function scrollToSection(event) {
event.preventDefault();
const targetId = event.currentTarget.getAttribute('href');
const targetSection = document.querySelector(targetId);
targetSection.scrollIntoView({behavior: 'smooth'});
}
</script>
<section id="home">
<div class="section-container">
<button>Test button</button>
</div>
</section>
<section id="o-mnie">
<div class="section-container">
<button>Test button</button>
</div>
</section>
<section id="uslugi">
<div class="section-container">
<button>Test button</button>
</div>
</section>
<section id="portfolio">
<div class="section-container">
<button>Test button</button>
</div>
</section>
<section id="wspolpraca">
<div class="section-container">
<button>Test button</button>
</div>
</section>
<section id="kontakt">
<div class="section-container">
<button>Test button</button>
</div>
</section>
</body>
</html>