Download script.js from Sarbajit8/inkmaster-pro-printopia: direct link, hf CLI and curl.
- Browser
- Download file 3.47 kB
-
https://huggingface.co/spaces/Sarbajit8/inkmaster-pro-printopia/resolve/main/script.js
- Command line
-
hf download hf://spaces/Sarbajit8/inkmaster-pro-printopia/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Sarbajit8/inkmaster-pro-printopia/resolve/main/script.js
3.47 kB
| // Hero Slider Functionality | |
| let currentSlide = 0; | |
| const slides = document.querySelectorAll('.slide'); | |
| const dots = document.querySelectorAll('.slider-dot'); | |
| function showSlide(index) { | |
| slides.forEach(slide => slide.classList.remove('active')); | |
| dots.forEach(dot => dot.classList.remove('active')); | |
| slides[index].classList.add('active'); | |
| dots[index].classList.add('active'); | |
| currentSlide = index; | |
| } | |
| function nextSlide() { | |
| let nextIndex = (currentSlide + 1) % slides.length; | |
| showSlide(nextIndex); | |
| } | |
| // Set up slider controls | |
| dots.forEach((dot, index) => { | |
| dot.addEventListener('click', () => showSlide(index)); | |
| }); | |
| // Auto-rotate slides | |
| setInterval(nextSlide, 5000); | |
| // Initialize first slide | |
| showSlide(0); | |
| // Mobile menu toggle functionality | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const mobileMenuButton = document.querySelector('button[class*="md:hidden"]'); | |
| const navLinks = document.querySelector('.hidden.md\\:flex'); | |
| if (mobileMenuButton && navLinks) { | |
| mobileMenuButton.addEventListener('click', function() { | |
| navLinks.classList.toggle('hidden'); | |
| navLinks.classList.toggle('flex'); | |
| navLinks.classList.toggle('flex-col'); | |
| navLinks.classList.toggle('absolute'); | |
| navLinks.classList.toggle('top-16'); | |
| navLinks.classList.toggle('left-0'); | |
| navLinks.classList.toggle('right-0'); | |
| navLinks.classList.toggle('bg-white'); | |
| navLinks.classList.toggle('p-4'); | |
| navLinks.classList.toggle('shadow-md'); | |
| navLinks.classList.toggle('space-y-4'); | |
| navLinks.classList.toggle('space-x-0'); | |
| }); | |
| } | |
| // Smooth scrolling for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| const targetId = this.getAttribute('href'); | |
| if (targetId === '#') return; | |
| const targetElement = document.querySelector(targetId); | |
| if (targetElement) { | |
| window.scrollTo({ | |
| top: targetElement.offsetTop - 80, | |
| behavior: 'smooth' | |
| }); | |
| // Close mobile menu if open | |
| if (!navLinks.classList.contains('hidden')) { | |
| mobileMenuButton.click(); | |
| } | |
| } | |
| }); | |
| }); | |
| // Form submission handling | |
| const contactForm = document.querySelector('form'); | |
| if (contactForm) { | |
| contactForm.addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| // Get form values | |
| const name = document.getElementById('name').value; | |
| const email = document.getElementById('email').value; | |
| const phone = document.getElementById('phone').value; | |
| const message = document.getElementById('message').value; | |
| // Here you would typically send the data to a server | |
| console.log('Form submitted:', { name, email, phone, message }); | |
| // Show success message | |
| alert('Thank you for your message! We will get back to you soon.'); | |
| // Reset form | |
| contactForm.reset(); | |
| }); | |
| } | |
| // Feather icons replacement | |
| feather.replace(); | |
| }); |