Demo: https://tuanphan-demo01.squarespace.com/hover-image-show-image?noredirect
Password: abc
Suppose you have 2 images, and you want to hover over an image, the rest will appear.
#1. First, add 2 Image Blocks.
#2. Edit the Left Image Block and add this URL:
- #image01
Make sure “Open Link in New Tab” is disabled
#2. Install Squarespace ID Finder to find the ID of Image Blocks
In my example, we will have:
- Left Image: No need to find ID
- Right Image: #block-yui_3_17_2_1_1714008816100_8348
#3. Use this code to Code Injection – Footer (or Page Header Code Injection)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script> <script> $(document).ready(function(){ $('a[href="#image01"]').hover(function(){ $("#block-yui_3_17_2_1_1714008816100_8348").addClass("show"); }, function(){ $("#block-yui_3_17_2_1_1714008816100_8348").removeClass("show"); }) }); </script> <style> #block-yui_3_17_2_1_1714008816100_8348 { display: none; } .show { display: block !important; } .show { z-index: 999999 !important; } </style>
#4. Explain code