Spaces:
Running
Running
aggiungi galleria immagini
Browse filesFiles changed (2)
- gallery.html+21-318
- index.html+2
32 unmodified lines3334353636373839404041424344464546474837 unmodified lines868788909189909193949596979899100101102103104105106107108109110111112113114115116117118119120121122123929394959646 unmodified lines1431441451761771781791801811821831461841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462471471481491 unmodified line15115215325515415515624 unmodified lines1811821832861841851862892902912922932942952962972982991873013021881891903051913073081923103113123133143153163173183193203213223233243253263273283293303313323333343353363373383391931941951961971981992002013423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364372022034382042052061 unmodified line20820921021121221321421521645145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449521721821922022122222350250350450550650750850951051151251351451551651751851952052122422522632 unmodified lines position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(1); transform: translate(-50%, -50%); object-fit: contain; transition: transform 0.3s ease; cursor: zoom-in; transform-origin: center center; } .modal-content.zoomed { transform: translate(-50%, -50%) scale(1.5); cursor: zoom-out; }.close { .close { position: absolute; top: 15px; right: 35px;37 unmodified lines </div> </section>
<!-- Gallery Filters --> <section class="py-10 bg-white"> <!-- Gallery Grid --> <section class="py-10 bg-gray-50"> <div class="container mx-auto px-6"> <div class="flex flex-wrap justify-center gap-4" data-aos="fade-up"> <button class="px-4 py-2 bg-green-600 text-white rounded-full">Tutte</button> <button class="px-4 py-2 bg-green-100 text-green-800 rounded-full hover:bg-green-200">Struttura</button> <button class="px-4 py-2 bg-green-100 text-green-800 rounded-full hover:bg-green-200">Camere</button> <button class="px-4 py-2 bg-green-100 text-green-800 rounded-full hover:bg-green-200">Paesaggi</button> <button class="px-4 py-2 bg-green-100 text-green-800 rounded-full hover:bg-green-200">Prodotti</button> <button class="px-4 py-2 bg-green-100 text-green-800 rounded-full hover:bg-green-200">Attività</button> </div> </div> </section> <!-- Gallery Slider --> <section class="py-10 bg-gray-50 relative"> <div class="container mx-auto px-6 overflow-hidden"> <div class="relative"> <div class="gallery-slider flex transition-transform duration-300 ease-out"> <!-- Slider Images will be added here --> </div> <button class="slider-prev absolute left-0 top-1/2 transform -translate-y-1/2 bg-white/80 hover:bg-white text-green-800 p-3 rounded-full shadow-lg z-10 ml-2"> <i data-feather="chevron-left" class="w-6 h-6"></i> </button> <button class="slider-next absolute right-0 top-1/2 transform -translate-y-1/2 bg-white/80 hover:bg-white text-green-800 p-3 rounded-full shadow-lg z-10 mr-2"> <i data-feather="chevron-right" class="w-6 h-6"></i> </button> </div> <div class="thumbnails-container mt-6 overflow-x-auto"> <div class="thumbnails flex space-x-2 justify-center"> <!-- Thumbnails will be added here --> </div> </div> </div><!-- Image 1 --> <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8"> <!-- Image 1 --> <div class="gallery-item rounded-lg overflow-hidden shadow-lg bg-white" data-aos="fade-up"> <img src="http://static.photos/nature/640x360/1" alt="Vista agriturismo" class="w-full h-64 object-cover"> <div class="p-4">46 unmodified lines <p class="text-gray-600 text-sm">Alla scoperta delle Cinque Terre</p> </div> </div> <!-- Image 7 --> <div class="gallery-item rounded-lg overflow-hidden shadow-lg bg-white" data-aos="fade-up" data-aos-delay="200"> <img src="http://static.photos/food/640x360/7" alt="Degustazione" class="w-full h-64 object-cover"> <div class="p-4"> <h3 class="text-lg font-semibold text-green-800">Degustazioni</h3> <p class="text-gray-600 text-sm">Vini e prodotti tipici liguri</p> </div> </div> </div> <!-- Image 8 --> <div class="gallery-item rounded-lg overflow-hidden shadow-lg bg-white" data-aos="fade-up" data-aos-delay="300"> <img src="http://static.photos/nature/640x360/8" alt="Tramonto" class="w-full h-64 object-cover"> <div class="p-4"> <h3 class="text-lg font-semibold text-green-800">Tramonti liguri</h3> <p class="text-gray-600 text-sm">Magiche atmosfere al calar del sole</p> </div> </div> <!-- Image 9 --> <div class="gallery-item rounded-lg overflow-hidden shadow-lg bg-white" data-aos="fade-up"> <img src="http://static.photos/indoor/640x360/9" alt="Bagno" class="w-full h-64 object-cover"> <div class="p-4"> <h3 class="text-lg font-semibold text-green-800">Bagno Suite</h3> <p class="text-gray-600 text-sm">Bagno spazioso con vasca idromassaggio</p> </div> </div> <!-- Image 10 --> <div class="gallery-item rounded-lg overflow-hidden shadow-lg bg-white" data-aos="fade-up" data-aos-delay="100"> <img src="http://static.photos/outdoor/640x360/10" alt="Giardino" class="w-full h-64 object-cover"> <div class="p-4"> <h3 class="text-lg font-semibold text-green-800">Giardino</h3> <p class="text-gray-600 text-sm">Area relax con vista panoramica</p> </div> </div> <!-- Image 11 --> <div class="gallery-item rounded-lg overflow-hidden shadow-lg bg-white" data-aos="fade-up" data-aos-delay="200"> <img src="http://static.photos/food/640x360/11" alt="Vino" class="w-full h-64 object-cover"> <div class="p-4"> <h3 class="text-lg font-semibold text-green-800">Cantina</h3> <p class="text-gray-600 text-sm">I nostri vini DOC della Liguria</p> </div> </div> <!-- Image 12 --> <div class="gallery-item rounded-lg overflow-hidden shadow-lg bg-white" data-aos="fade-up" data-aos-delay="300"> <img src="http://static.photos/travel/640x360/12" alt="Spiaggia" class="w-full h-64 object-cover"> <div class="p-4"> <h3 class="text-lg font-semibold text-green-800">Spiaggia</h3> <p class="text-gray-600 text-sm">A pochi minuti dalla struttura</p> </div> </div> <!-- Image 13 --> <div class="gallery-item rounded-lg overflow-hidden shadow-lg bg-white" data-aos="fade-up"> <img src="http://static.photos/indoor/640x360/13" alt="Sala colazione" class="w-full h-64 object-cover"> <div class="p-4"> <h3 class="text-lg font-semibold text-green-800">Sala Colazione</h3> <p class="text-gray-600 text-sm">Ambiente accogliente e luminoso</p> </div> </div> <!-- Image 14 --> <div class="gallery-item rounded-lg overflow-hidden shadow-lg bg-white" data-aos="fade-up" data-aos-delay="100"> <img src="http://static.photos/nature/640x360/14" alt="Vigneto" class="w-full h-64 object-cover"> <div class="p-4"> <h3 class="text-lg font-semibold text-green-800">Vigneto</h3> <p class="text-gray-600 text-sm">Produzione di vino biologico</p> </div> </div></div> </div> </section>
1 unmodified line <div id="imageModal" class="modal"> <span class="close">×</span> <img class="modal-content" id="modalImage"> <div id="caption" class="text-center text-white mt-2"></div> </div>
<!-- Footer -->24 unmodified lines // Mobile menu toggle document.querySelector('button[aria-label="menu"]').addEventListener('click', function() { const menu = document.querySelector('.md\\:hidden + .hidden.md\\:flex'); const menu = document.querySelector('.md\\:hidden + .hidden'); menu.classList.toggle('hidden'); }); // Gallery Slider functionality const galleryImages = [ {src: "http://static.photos/nature/1200x630/1", alt: "Vista agriturismo", title: "Vista panoramica", desc: "La nostra struttura immersa nel verde"}, {src: "http://static.photos/indoor/1200x630/2", alt: "Camera matrimoniale", title: "Camera Standard", desc: "Comfort e semplicità"}, {src: "http://static.photos/food/1200x630/3", alt: "Colazione", title: "Colazione biologica", desc: "Prodotti locali e fatti in casa"}, {src: "http://static.photos/nature/1200x630/4", alt: "Ulivi", title: "I nostri ulivi", desc: "Produzione di olio extravergine"}, {src: "http://static.photos/indoor/1200x630/5", alt: "Suite", title: "Suite Vista Mare", desc: "Lusso e comfort con vista panoramica"}, {src: "http://static.photos/travel/1200x630/6", alt: "Escursione", title: "Escursioni", desc: "Alla scoperta delle Cinque Terre"}, {src: "http://static.photos/food/1200x630/7", alt: "Degustazione", title: "Degustazioni", desc: "Vini e prodotti tipici liguri"}, {src: "http://static.photos/nature/1200x630/8", alt: "Tramonto", title: "Tramonti liguri", desc: "Magiche atmosfere al calar del sole"} ];
const slider = document.querySelector('.gallery-slider'); const thumbnails = document.querySelector('.thumbnails'); // Image modal functionality const modal = document.getElementById("imageModal"); const modalImg = document.getElementById("modalImage"); const captionText = document.getElementById("caption"); const closeBtn = document.querySelector(".close"); const prevBtn = document.querySelector('.slider-prev'); const nextBtn = document.querySelector('.slider-next');
let currentIndex = 0; let isDragging = false; let startPosX = 0; let currentTranslate = 0; let prevTranslate = 0;
// Initialize slider function initSlider() { slider.innerHTML = ''; thumbnails.innerHTML = '';
galleryImages.forEach((img, index) => { // Main slider images const slide = document.createElement('div'); slide.className = 'min-w-full h-96 flex-shrink-0 relative'; slide.innerHTML = ` <img src="${img.src}" alt="${img.alt}" class="w-full h-full object-contain cursor-zoom-in"> <div class="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-4 text-white"> <h3 class="text-xl font-bold">${img.title}</h3> <p>${img.desc}</p> </div> `; slider.appendChild(slide);
// Thumbnails const thumb = document.createElement('div'); thumb.className = `thumbnail w-20 h-20 rounded overflow-hidden cursor-pointer border-2 ${index === 0 ? 'border-green-600' : 'border-transparent'}`; thumb.innerHTML = `<img src="${img.src}" alt="${img.alt}" class="w-full h-full object-cover">`; thumb.addEventListener('click', () => goToSlide(index)); thumbnails.appendChild(thumb); // Get all gallery images and add click event document.querySelectorAll('.gallery-item img').forEach(img => { img.addEventListener('click', function() { modal.style.display = "block"; modalImg.src = this.src; modalImg.alt = this.alt; }); });
updateSlider(); addEventListeners(); }
function updateSlider() { slider.style.transform = `translateX(-${currentIndex * 100}%)`; // Update active thumbnail document.querySelectorAll('.thumbnail').forEach((thumb, idx) => { thumb.classList.toggle('border-green-600', idx === currentIndex); thumb.classList.toggle('border-transparent', idx !== currentIndex); }); }
function goToSlide(index) { currentIndex = index; updateSlider(); }
function nextSlide() { if (currentIndex < galleryImages.length - 1) { currentIndex++; updateSlider(); } }
function prevSlide() { if (currentIndex > 0) { currentIndex--; updateSlider(); } }
function addEventListeners() { // Navigation buttons nextBtn.addEventListener('click', nextSlide); prevBtn.addEventListener('click', prevSlide);
// Keyboard navigation document.addEventListener('keydown', (e) => { if (e.key === 'ArrowRight') nextSlide(); if (e.key === 'ArrowLeft') prevSlide(); });
// Touch events for swipe slider.addEventListener('touchstart', touchStart); slider.addEventListener('touchmove', touchMove); slider.addEventListener('touchend', touchEnd);
// Mouse events for drag slider.addEventListener('mousedown', touchStart); slider.addEventListener('mousemove', touchMove); slider.addEventListener('mouseup', touchEnd); slider.addEventListener('mouseleave', touchEnd);
// Image zoom modal document.querySelectorAll('.gallery-slider img').forEach(img => { img.addEventListener('click', function() { modal.style.display = "block"; modalImg.src = this.src; modalImg.alt = this.alt; captionText.innerHTML = `${this.parentElement.nextElementSibling.querySelector('h3').textContent} - ${this.parentElement.nextElementSibling.querySelector('p').textContent}`; }); }); }
function touchStart(e) { if (e.type === 'touchstart') { startPosX = e.touches[0].clientX; } else { startPosX = e.clientX; e.preventDefault(); } isDragging = true; prevTranslate = currentTranslate; }
function touchMove(e) { if (!isDragging) return; const currentPosition = e.type === 'touchmove' ? e.touches[0].clientX : e.clientX; currentTranslate = prevTranslate + currentPosition - startPosX; }
function touchEnd() { isDragging = false; const movedBy = currentTranslate - prevTranslate;
if (movedBy < -50) nextSlide(); if (movedBy > 50) prevSlide();
currentTranslate = -currentIndex * 100; slider.style.transform = `translateX(${currentTranslate}%)`; }
// Modal functionality modalImg.addEventListener('click', function(e) { // Zoom functionality modalImg.addEventListener('click', function() { e.stopPropagation(); if (this.classList.contains('zoomed')) { this.classList.remove('zoomed'); } else {1 unmodified line } });
// Close modal when clicking X closeBtn.addEventListener('click', function() { modal.style.display = "none"; modalImg.classList.remove('zoomed'); });
modal.addEventListener('click', function(e) { if (e.target === modal) { modal.style.display = "none"; modalImg.classList.remove('zoomed'); } });
// Initialize slider on load initSlider();// Zoom functionality modalImg.addEventListener('click', function(e) { e.stopPropagation(); if (this.classList.contains('zoomed')) { this.classList.remove('zoomed'); // Reset to initial proportional scaling const imgWidth = this.naturalWidth; const imgHeight = this.naturalHeight; const windowWidth = window.innerWidth * 0.9; const windowHeight = window.innerHeight * 0.9;
const widthRatio = windowWidth / imgWidth; const heightRatio = windowHeight / imgHeight; const scale = Math.min(widthRatio, heightRatio);
this.style.transform = `translate(-50%, -50%) scale(${scale})`; } else { this.classList.add('zoomed'); // Zoom to fit the larger dimension while maintaining aspect ratio const imgWidth = this.naturalWidth; const imgHeight = this.naturalHeight; const windowWidth = window.innerWidth; const windowHeight = window.innerHeight;
const widthRatio = windowWidth / imgWidth; const heightRatio = windowHeight / imgHeight; const scale = Math.min(widthRatio, heightRatio) * 0.9;
this.style.transform = `translate(-50%, -50%) scale(${scale})`; } });// Close modal when clicking X closeBtn.addEventListener('click', function() { modal.style.display = "none"; });
// Close modal when clicking outside image modal.addEventListener('click', function(e) { if (e.target === modal) { modal.style.display = "none"; modalImg.classList.remove('zoomed'); } }); // Filter functionality document.querySelectorAll('.flex button').forEach(button => { button.addEventListener('click', function() { this.classList.remove('bg-green-100', 'text-green-800'); this.classList.add('bg-green-600', 'text-white'); document.querySelectorAll('.flex button').forEach(btn => { if (btn !== this) { btn.classList.add('bg-green-100', 'text-green-800'); btn.classList.remove('bg-green-600', 'text-white'); } }); }); });
// Prevent context menu on slider for better UX slider.addEventListener('contextmenu', (e) => { e.preventDefault(); });</script> </script></body></html>74 unmodified lines757677787980814 unmodified lines8687888990919274 unmodified lines <a href="#rooms" class="text-green-800 hover:text-green-600">Camere</a> <a href="#services" class="text-green-800 hover:text-green-600">Servizi</a> <a href="#contact" class="text-green-800 hover:text-green-600">Contatti</a> <a href="gallery.html" class="text-green-800 hover:text-green-600">Galleria</a></div> <button class="md:hidden focus:outline-none"> <i data-feather="menu"></i>4 unmodified lines <a href="#rooms" class="block py-2 text-green-800 hover:text-green-600">Camere</a> <a href="#services" class="block py-2 text-green-800 hover:text-green-600">Servizi</a> <a href="#contact" class="block py-2 text-green-800 hover:text-green-600">Contatti</a> <a href="gallery.html" class="block py-2 text-green-800 hover:text-green-600">Galleria</a></div></div> </div>gallery.html+21-318
index.html+2