diff --git a/color.css b/color.css index 4454ce1..ac7c770 100644 --- a/color.css +++ b/color.css @@ -534,4 +534,83 @@ input:checked + .slider:before { #copy-link-button:hover { background-color: #45a049; +} + +/* --- Zoom Overlay Feature --- */ + +#zoom-overlay { + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + background-color: rgba(0, 0, 0, 0.75); /* Dark, semi-transparent background */ + z-index: 1001; /* Ensure it's on top of everything */ + + /* Use flexbox to center the content */ + display: flex; + justify-content: center; + align-items: center; + + /* Start hidden and transition opacity */ + opacity: 0; + visibility: hidden; + transition: opacity 0.3s ease, visibility 0.3s ease; + + cursor: zoom-out; /* Hint to the user how to close it */ +} + +/* The class we'll toggle with JavaScript to show the overlay */ +#zoom-overlay.is-active { + opacity: 1; + visibility: visible; +} + +/* The container for the zoomed-in palette balloons */ +#zoomed-palette-content { + width: 90vw; + height: 80vh; + padding: 20px; + + /* Looks like the original palette */ + background-color: #e8e8e8; + background-image: url("https://www.transparenttextures.com/patterns/asfalt-light.png"); + border-radius: 15px; + + /* Allow scrolling if there are many balloons */ + overflow-y: auto; + + /* Arrange the cloned balloons */ + display: flex; + flex-wrap: wrap; + justify-content: center; + align-items: center; + gap: 20px; + + cursor: default; /* Use a normal cursor for the content itself */ +} + +/* Make the balloons and their names larger in the zoom view */ +#zoomed-palette-content .swatch-wrapper { + transform: scale(1.1); +} + +/* --- Definitive Rules for Larger Selected Balloons --- */ +/* Using !important to forcefully override any other conflicting styles. */ + +/* This rule ensures the wrapper can expand to fit the larger balloon */ +#selected-palette .swatch-wrapper { + width: auto !important; + max-width: none !important; +} + +/* This rule sets the new, larger size for the balloon swatch */ +#selected-palette .color-swatch { + width: 130px !important; + height: 177px !important; +} + +/* This rule re-aligns the balloon string to match the new height */ +#selected-palette .balloon-string-svg { + top: 108px !important; } \ No newline at end of file diff --git a/index.html b/index.html index 571cd04..5f790b9 100644 --- a/index.html +++ b/index.html @@ -1,102 +1,92 @@ - Beach Party Balloons Color Palette Picker + - - + + + - - - - - + + + + + - - -
-
-

Your Palette

-
- - - +
- -
+ + + -
-
-

Share Your Palette

- - -
-
-
+
+
+
+

Your Palette

+
+ + + + +
+
+ +
+
+ + +
+
+
+
+ + +
+
+

Share Your Palette

+ + +
+
+ +
+
+
diff --git a/script.js b/script.js index 8ac66c1..053109e 100644 --- a/script.js +++ b/script.js @@ -349,4 +349,57 @@ modalBackdrop.addEventListener('click', (event) => { if (event.target === modalBackdrop) { modalBackdrop.style.display = 'none'; } +}); + +// --- Zoom Palette Functionality --- + +const zoomButton = document.getElementById('zoom-palette'); +const zoomOverlay = document.getElementById('zoom-overlay'); +const zoomedPaletteContent = document.getElementById('zoomed-palette-content'); + +// --- Event Listener to OPEN the zoom view --- +zoomButton.addEventListener('click', () => { + // Don't do anything if the palette is empty + if (selectedPalette.length === 0) { + alert("Palette is empty. Add some colors to zoom in!"); + return; + } + + // Get the original container of the colored balloons + const originalPaletteColors = document.getElementById('palette-colors'); + + // Clear any old content and create a deep clone of the balloons + zoomedPaletteContent.innerHTML = ''; + const clonedContent = originalPaletteColors.cloneNode(true); + + // The clone doesn't need its own ID + clonedContent.id = ''; + + // Append the cloned balloons to our zoom container + zoomedPaletteContent.appendChild(clonedContent); + + // Show the overlay by adding the .is-active class + zoomOverlay.classList.add('is-active'); +}); + +// --- Function to CLOSE the zoom view --- +function closeZoomView() { + zoomOverlay.classList.remove('is-active'); +} + +// --- Two ways to CLOSE the view for easy access --- + +// 1. Click on the dark background (the overlay itself) +zoomOverlay.addEventListener('click', (event) => { + // Only close if the click is on the overlay, not the content inside + if (event.target === zoomOverlay) { + closeZoomView(); + } +}); + +// 2. Press the 'Escape' key +document.addEventListener('keydown', (event) => { + if (event.key === 'Escape' && zoomOverlay.classList.contains('is-active')) { + closeZoomView(); + } }); \ No newline at end of file