mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 18:51:07 -05:00
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.
This commit is contained in:
33
static/js/optimization.js
Normal file
33
static/js/optimization.js
Normal file
@@ -0,0 +1,33 @@
|
||||
// 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');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user