Files
thrillwiki_django_no_react/static/js/optimization.js
pacnpal b9063ff4f8 feat: Add detailed park and ride pages with HTMX integration
- Implemented park detail page with dynamic content loading for rides and weather.
- Created park list page with filters and search functionality.
- Developed ride detail page showcasing ride stats, reviews, and similar rides.
- Added ride list page with filtering options and dynamic loading.
- Introduced search results page with tabs for parks, rides, and users.
- Added HTMX tests for global search functionality.
2025-12-19 19:53:20 -05:00

34 lines
964 B
JavaScript

// Lightbox Functionality
document.addEventListener('alpine:init', () => {
Alpine.data('lightbox', () => ({
isOpen: false,
imgSrc: '',
imgAlt: '',
open(event) {
const img = event.target.tagName === 'IMG' ? event.target : event.target.querySelector('img');
if (img) {
this.imgSrc = img.src;
this.imgAlt = img.alt;
this.isOpen = true;
document.body.style.overflow = 'hidden';
}
},
close() {
this.isOpen = false;
this.imgSrc = '';
this.imgAlt = '';
document.body.style.overflow = '';
}
}));
});
// Add lazy loading to all images
document.addEventListener('DOMContentLoaded', () => {
const images = document.querySelectorAll('img:not([loading])');
images.forEach(img => {
img.setAttribute('loading', 'lazy');
});
});