Spaces:
Running
Running
I need a home page, each section should have background image, title, sub title, paragraph, section image. Each section should scroll as a slider scrolls, Each section should have 100vh min-height header should be absolute and sticky. Each section should have animation and smooth transition to one scroll to another and having 6 sections
d03961b verified Download components/header.js from testfws2025/scrollscape-voyager: direct link, hf CLI and curl.
- Browser
- Download file 3.07 kB
-
https://huggingface.co/spaces/testfws2025/scrollscape-voyager/resolve/main/components/header.js
- Command line
-
hf download hf://spaces/testfws2025/scrollscape-voyager/components/header.js
-
curl -L -o header.js https://huggingface.co/spaces/testfws2025/scrollscape-voyager/resolve/main/components/header.js
3.07 kB
| class CustomHeader extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| position: fixed; | |
| top: 0; | |
| left: 0; | |
| right: 0; | |
| z-index: 1000; | |
| transition: all 0.3s ease; | |
| padding: 1rem 2rem; | |
| } | |
| .header-container { | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| max-width: 1200px; | |
| margin: 0 auto; | |
| width: 100%; | |
| } | |
| .logo { | |
| font-family: 'Playfair Display', serif; | |
| font-size: 1.5rem; | |
| font-weight: 700; | |
| color: white; | |
| text-decoration: none; | |
| } | |
| .nav-links { | |
| display: flex; | |
| gap: 2rem; | |
| } | |
| .nav-link { | |
| color: white; | |
| text-decoration: none; | |
| font-weight: 500; | |
| position: relative; | |
| padding: 0.5rem 0; | |
| } | |
| .nav-link::after { | |
| content: ''; | |
| position: absolute; | |
| bottom: 0; | |
| left: 0; | |
| width: 0; | |
| height: 2px; | |
| background-color: white; | |
| transition: width 0.3s ease; | |
| } | |
| .nav-link:hover::after { | |
| width: 100%; | |
| } | |
| @media (max-width: 768px) { | |
| .nav-links { | |
| display: none; | |
| } | |
| .mobile-menu-btn { | |
| display: block; | |
| } | |
| } | |
| </style> | |
| <header class="header-container"> | |
| <a href="#section1" class="logo">ScrollScape</a> | |
| <nav class="nav-links"> | |
| <a href="#section1" class="nav-link">Home</a> | |
| <a href="#section2" class="nav-link">Innovate</a> | |
| <a href="#section3" class="nav-link">Nature</a> | |
| <a href="#section4" class="nav-link">Cities</a> | |
| <a href="#section5" class="nav-link">Creativity</a> | |
| <a href="#section6" class="nav-link">Contact</a> | |
| </nav> | |
| <button class="mobile-menu-btn hidden"> | |
| <i data-feather="menu"></i> | |
| </button> | |
| </header> | |
| `; | |
| } | |
| } | |
| customElements.define('custom-header', CustomHeader); |