Flip Zoom - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Flip Zoom</title> <style> body { font-family: Arial, sans-serif; background-color: #f0e68c; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .flip-zoom-container { position: relative; display: inline-block; cursor: pointer; perspective: 1000px; } .flip-zoom-container img { width: 100%; height: auto; transition: transform 0.6s ease, box-shadow 0.6s ease; border-radius: 20px; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); } .flip-zoom-container:hover img { transform: rotateY(180deg); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4); } .flip-zoom-icon { position: absolute; top: 10px; right: 10px; background-color: rgba(255, 255, 255, 0.9); border-radius: 50%; padding: 5px; font-size: 30px; transition: transform 0.6s ease; } .flip-zoom-container:hover .flip-zoom-icon { transform: rotateY(180deg); } .flip-zoom-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.8); display: none; justify-content: center; align-items: center; z-index: 1000; animation: fadeIn 0.6s ease; } .flip-zoom-overlay img { max-width: 90%; max-height: 90%; border-radius: 20px; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5); transform: scale(0.8); animation: zoomIn 0.6s ease forwards; } .flip-zoom-overlay .close-icon { position: absolute; top: 20px; right: 20px; background-color: rgba(255, 255, 255, 0.9); border-radius: 50%; padding: 10px; font-size: 36px; cursor: pointer; transition: transform 0.6s ease; } .flip-zoom-overlay .close-icon:hover { transform: scale(1.2); } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } @keyframes zoomIn { from { transform: scale(0.8); } to { transform: scale(1); } } </style> </head> <body> <div class="flip-zoom-container"> <img src="https://via.placeholder.com/600x400" alt="Zoom Image"> <div class="flip-zoom-icon">🔍</div> </div> <div class="flip-zoom-overlay" id="flip-zoom-overlay"> <img src="https://via.placeholder.com/600x400" alt="Zoom Image"> <div class="close-icon" id="flip-close-icon">❌</div> </div> <script> const flipZoomContainer = document.querySelector('.flip-zoom-container'); const flipZoomOverlay = document.getElementById('flip-zoom-overlay'); const flipCloseIcon = document.getElementById('flip-close-icon'); const flipZoomImage = flipZoomContainer.querySelector('img'); const flipOverlayImage = flipZoomOverlay.querySelector('img'); flipZoomContainer.addEventListener('click', () => { flipOverlayImage.src = flipZoomImage.src; flipZoomOverlay.style.display = 'flex'; }); flipCloseIcon.addEventListener('click', () => { flipZoomOverlay.style.display = 'none'; }); flipZoomOverlay.addEventListener('click', (e) => { if (e.target === flipZoomOverlay) { flipZoomOverlay.style.display = 'none'; } }); </script> </body> </html>