How to Create a Rollover Image Effect
To create a Rollover Image Effect, follow these steps:
Add a gallery with the "Stacked" design
Add 2 images
Find a gallery block ID via the Chrome extension "Squarespace Collection/Block Identifier"
Copy the styles below to a text/code editor and replace #block with the gallery block ID that you found in the 3 step.
Add edited styles to Custom CSS
/* Rollover Image Effect */ #block .sqs-gallery-block-stacked { .sqs-gallery { position: relative; } .image-wrapper:hover ~ .image-wrapper { opacity: 1; } .image-wrapper ~ .image-wrapper { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; transition: opacity 0.3s ease-in; } }
Note: You can skip 3-4 steps. Add this style to the page header code injection where is a gallery. Be careful, this code will affect all galleries with the "Stacked" design on a page.
<!-- Rollover Image Effect --> <style> .sqs-gallery-block-stacked .sqs-gallery { position: relative; } .sqs-gallery-block-stacked .sqs-gallery .image-wrapper:hover ~ .image-wrapper { opacity: 1; } .sqs-gallery-block-stacked .sqs-gallery .image-wrapper ~ .image-wrapper { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; transition: opacity 0.3s ease-in; } </style> <!-- end Rollover Image Effect -->