mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 15:31:08 -05:00
- 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.
34 lines
964 B
JavaScript
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');
|
|
});
|
|
});
|