Spaces:
Running
Running
Download script.js from Majdnr111/pdf-rocket-reader: direct link, hf CLI and curl.
- Browser
- Download file 1.53 kB
-
https://huggingface.co/spaces/Majdnr111/pdf-rocket-reader/resolve/main/script.js
- Command line
-
hf download hf://spaces/Majdnr111/pdf-rocket-reader/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Majdnr111/pdf-rocket-reader/resolve/main/script.js
1.53 kB
| // Smooth scrolling for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| // Mobile menu toggle | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const mobileMenuBtn = document.querySelector('.mobile-menu-btn'); | |
| const mobileNav = document.querySelector('.mobile-nav'); | |
| if(mobileMenuBtn && mobileNav) { | |
| mobileMenuBtn.addEventListener('click', function() { | |
| mobileNav.classList.toggle('show'); | |
| }); | |
| } | |
| }); | |
| // Animation on scroll | |
| const animateOnScroll = () => { | |
| const elements = document.querySelectorAll('.feature-card'); | |
| elements.forEach(element => { | |
| const elementPosition = element.getBoundingClientRect().top; | |
| const screenPosition = window.innerHeight / 1.2; | |
| if(elementPosition < screenPosition) { | |
| element.style.opacity = '1'; | |
| element.style.transform = 'translateY(0)'; | |
| } | |
| }); | |
| }; | |
| // Set initial state for animation | |
| document.querySelectorAll('.feature-card').forEach(card => { | |
| card.style.opacity = '0'; | |
| card.style.transform = 'translateY(20px)'; | |
| card.style.transition = 'all 0.5s ease'; | |
| }); | |
| window.addEventListener('scroll', animateOnScroll); | |
| window.addEventListener('load', animateOnScroll); | |
| console.log("Modern Starter Template Loaded"); | |