new navigation

This commit is contained in:
nadja
2026-09-03 17:06:24 +02:00
parent df3c972342
commit e10519e808
3 changed files with 206 additions and 1 deletions

64
app.js
View File

@@ -65,8 +65,72 @@
wrap.appendChild(iframe);
}
/* ------------------------------------------------------------------
* Sticky Navigation & Back-to-Top
* ------------------------------------------------------------------ */
function initNavigation() {
var nav = document.getElementById("sticky-nav");
var backToTop = document.getElementById("back-to-top");
var navLinks = document.querySelectorAll(".nav-link[data-section]");
var sections = [];
navLinks.forEach(function (link) {
var id = link.getAttribute("data-section");
var el = document.getElementById(id);
if (el) sections.push({ id: id, el: el, link: link });
});
function onScroll() {
var scrollY = window.scrollY || window.pageYOffset;
if (scrollY > 300) {
nav.classList.add("visible");
backToTop.classList.add("visible");
} else {
nav.classList.remove("visible");
backToTop.classList.remove("visible");
}
var active = null;
for (var i = 0; i < sections.length; i++) {
var rect = sections[i].el.getBoundingClientRect();
if (rect.top <= 120) active = sections[i];
}
navLinks.forEach(function (l) { l.classList.remove("active"); });
if (active) active.link.classList.add("active");
}
window.addEventListener("scroll", onScroll, { passive: true });
onScroll();
backToTop.addEventListener("click", function () {
window.scrollTo({ top: 0, behavior: "smooth" });
});
navLinks.forEach(function (link) {
link.addEventListener("click", function (e) {
e.preventDefault();
var id = this.getAttribute("data-section");
var target = document.getElementById(id);
if (target) {
target.scrollIntoView({ behavior: "smooth" });
}
});
});
var brandLink = document.querySelector(".nav-brand");
if (brandLink) {
brandLink.addEventListener("click", function (e) {
e.preventDefault();
window.scrollTo({ top: 0, behavior: "smooth" });
});
}
}
document.addEventListener("DOMContentLoaded", function () {
loadYouTube();
loadTwitch();
initNavigation();
});
})();

View File

@@ -10,7 +10,33 @@
</head>
<body>
<!-- Sticky Navigation -->
<nav class="sticky-nav" id="sticky-nav">
<div class="nav-inner">
<a href="#hero" class="nav-link nav-brand">Duda17</a>
<div class="nav-links">
<a href="#youtube" class="nav-link" data-section="youtube">
<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"/></svg>
YouTube
</a>
<a href="#tiktok" class="nav-link" data-section="tiktok">
<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M19.59 6.69a4.83 4.83 0 0 1-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 0 1-2.88 2.5 2.89 2.89 0 0 1 0-5.78 2.92 2.92 0 0 1 .88.13V9.4a6.84 6.84 0 0 0-1-.05A6.33 6.33 0 0 0 3 15.57 6.33 6.33 0 0 0 9.37 22a6.33 6.33 0 0 0 6.37-6.22V9.4a8.16 8.16 0 0 0 4.85 1.58V7.53a4.85 4.85 0 0 1-1-.84z"/></svg>
TikTok
</a>
<a href="#twitch" class="nav-link" data-section="twitch">
<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M11.571 4.714h1.715v5.143H11.57zm4.715 0H18v5.143h-1.714zM6 0L1.714 4.286v15.428h5.143V24l4.286-4.286h3.428L22.286 12V0zm14.571 11.143l-3.428 3.428h-3.429l-3 3v-3H6.857V1.714h13.714z"/></svg>
Twitch
</a>
<a href="#discord" class="nav-link" data-section="discord">
<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.947 2.418-2.157 2.418z"/></svg>
Discord
</a>
</div>
</div>
</nav>
<!-- Hero mit Profilbild -->
<header class="hero" id="hero">
<header class="hero">
<img src="https://yt3.googleusercontent.com/ytc/AIdro_nV0BeUU6X1nvBat082Xuau7R-DzRHMX0hBHONIGmStA9w=s900-c-k-c0x00ffffff-no-rj"
alt="Duda17 Profilbild" class="hero-avatar">
@@ -162,6 +188,11 @@
</div>
</footer>
<!-- Back-to-Top Button -->
<button class="back-to-top" id="back-to-top" aria-label="Nach oben scrollen">
<svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="18 15 12 9 6 15"/></svg>
</button>
<script src="videos.js"></script>
<script src="app.js"></script>
</body>

112
style.css
View File

@@ -45,6 +45,7 @@ body {
justify-content: center;
text-align: center;
padding: 60px 20px;
scroll-margin-top: 0;
background:
radial-gradient(ellipse at 15% 30%, rgba(255, 0, 0, 0.1) 0%, transparent 50%),
radial-gradient(ellipse at 50% 70%, rgba(0, 242, 234, 0.08) 0%, transparent 50%),
@@ -129,8 +130,111 @@ body {
.btn-lg { padding: 18px 36px; font-size: 1.1rem; }
/* Sticky Navigation */
.sticky-nav {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1000;
background: rgba(10, 10, 10, 0.85);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border-bottom: 1px solid var(--border);
transform: translateY(-100%);
transition: transform 0.3s ease;
}
.sticky-nav.visible {
transform: translateY(0);
}
.nav-inner {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
display: flex;
align-items: center;
justify-content: space-between;
height: 56px;
}
.nav-brand {
font-weight: 900;
font-size: 1.2rem;
letter-spacing: -1px;
background: linear-gradient(135deg, #fff 0%, #c0c0c0 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.nav-links {
display: flex;
gap: 4px;
}
.nav-link {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 8px 14px;
border-radius: 8px;
font-size: 0.85rem;
font-weight: 600;
color: var(--text-secondary);
text-decoration: none;
transition: all 0.2s ease;
}
.nav-link:hover {
color: var(--text-primary);
background: rgba(255, 255, 255, 0.06);
}
.nav-link.active {
color: var(--text-primary);
background: rgba(255, 255, 255, 0.1);
}
/* Back-to-Top Button */
.back-to-top {
position: fixed;
bottom: 32px;
right: 32px;
z-index: 999;
width: 48px;
height: 48px;
border-radius: 50%;
border: 1px solid var(--border);
background: var(--bg-card);
color: var(--text-primary);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
visibility: hidden;
transform: translateY(16px);
transition: all 0.3s ease;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.back-to-top.visible {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
.back-to-top:hover {
background: var(--twitch-purple);
border-color: var(--twitch-purple);
transform: translateY(-2px);
box-shadow: 0 6px 24px rgba(145, 70, 255, 0.4);
}
/* Sections */
.section { padding: 90px 0; scroll-margin-top: 20px; }
.section { padding: 90px 0; scroll-margin-top: 64px; }
.section-alt { background: var(--bg-secondary); }
.channel-head {
@@ -350,6 +454,12 @@ body {
.discord-card { padding: 28px 20px; }
.discord-profile { flex-direction: column; text-align: center; }
.nav-links { gap: 0; }
.nav-link { padding: 8px 8px; font-size: 0.75rem; }
.nav-link svg { display: none; }
.back-to-top { bottom: 20px; right: 20px; width: 42px; height: 42px; }
}
@media (max-width: 480px) {