Spaces:
Running
Running
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize tooltips | |
| const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); | |
| tooltipTriggerList.map(function (tooltipTriggerEl) { | |
| return new bootstrap.Tooltip(tooltipTriggerEl); | |
| }); | |
| // Cart quantity handlers | |
| document.querySelectorAll('.quantity-btn').forEach(btn => { | |
| btn.addEventListener('click', function() { | |
| const input = this.parentNode.querySelector('.quantity-input'); | |
| let value = parseInt(input.value); | |
| if (this.classList.contains('minus') && value > 1) { | |
| input.value = value - 1; | |
| } else if (this.classList.contains('plus')) { | |
| input.value = value + 1; | |
| } | |
| }); | |
| }); | |
| // 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' | |
| }); | |
| }); | |
| }); | |
| }); | |