Jump to content

How to create hover effect that affects other blocks

Recommended Posts

Hey all trying to create an effect where hovering over one block affects the action of a different block

I managed to do it in w3 try it using html with images assigned as parent/child but as soon as I try to do the same exact thing with direct blocks, I have an issue and im not sure how to resolve it.  Let me know if you can spot anything that I may be doing wrong.  I've inserted my w3 code as well at the bottom

 

Here is the site

https://blueberry-carrot-xawg.squarespace.com/selected

 

PW codeblock

 

 

#block-yui_3_17_2_1_1669839743068_49521 {
  width:100%;
        }
          
#block-yui_3_17_2_1_1669786934605_193853  {
  width: 100%;
  height: 100%;
  opacity:0;
  transition: opacity .5s ease;
        }
          
          
#block-yui_3_17_2_1_1669839743068_49521:hover #block-yui_3_17_2_1_1669786934605_193853  {
  opacity: 1 !important;
  transition: 1s;
        }
    

 

 

w3 try it code

<html>
  
<head>
    <style>
        body {
            text-align: center;
        }
          
     
          
        .parent {
            width: 600px;
            height: 200px;
    
        }
          
        .child {
            width: 100%;
            height: 100%;
            background-color:rgba(255, 255, 255, 0);
        }
          
     
          
        .parent:hover .child {
            opacity: 1 !important;
            transition: 1s !important;
        }
          
        .child {
            border: none;
            padding: 50px 160px;
            margin-top: 50px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
            opacity:0;
            transition: opacity .5s ease;
        }
    </style>
</head>
  
<body>
   
    <div class="parent"><img src="https://i.ibb.co/tKPzwMB/clapper-closed.png" alt="" />
        <button class="child"><img src="https://i.ibb.co/Xb8SRs1/closed.png" alt="" /> 
        </button>
    </div>
</body>
</html>

 

Edited by joshuaechevarriadop
Link to comment
  • joshuaechevarriadop changed the title to How to create hover effect that affects other blocks
16 hours ago, joshuaechevarriadop said:

Hey all trying to create an effect where hovering over one block affects the action of a different block

I managed to do it in w3 try it using html with images assigned as parent/child but as soon as I try to do the same exact thing with direct blocks, I have an issue and im not sure how to resolve it.  Let me know if you can spot anything that I may be doing wrong.  I've inserted my w3 code as well at the bottom

 

Here is the site

https://blueberry-carrot-xawg.squarespace.com/selected

 

PW codeblock

 

 

#block-yui_3_17_2_1_1669839743068_49521 {
  width:100%;
        }
          
#block-yui_3_17_2_1_1669786934605_193853  {
  width: 100%;
  height: 100%;
  opacity:0;
  transition: opacity .5s ease;
        }
          
          
#block-yui_3_17_2_1_1669839743068_49521:hover #block-yui_3_17_2_1_1669786934605_193853  {
  opacity: 1 !important;
  transition: 1s;
        }
    

 

 

w3 try it code

<html>
  
<head>
    <style>
        body {
            text-align: center;
        }
          
     
          
        .parent {
            width: 600px;
            height: 200px;
    
        }
          
        .child {
            width: 100%;
            height: 100%;
            background-color:rgba(255, 255, 255, 0);
        }
          
     
          
        .parent:hover .child {
            opacity: 1 !important;
            transition: 1s !important;
        }
          
        .child {
            border: none;
            padding: 50px 160px;
            margin-top: 50px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
            opacity:0;
            transition: opacity .5s ease;
        }
    </style>
</head>
  
<body>
   
    <div class="parent"><img src="https://i.ibb.co/tKPzwMB/clapper-closed.png" alt="" />
        <button class="child"><img src="https://i.ibb.co/Xb8SRs1/closed.png" alt="" /> 
        </button>
    </div>
</body>
</html>

 

Which block are you mentioning?

image.thumb.png.f6b5b64c4dd211e1203aef47ce5c68e8.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
3 minutes ago, Beyondspace said:

Which block are you mentioning?

image.thumb.png.f6b5b64c4dd211e1203aef47ce5c68e8.png

the circular images.  Also is that how the site is loading for you?  I have code removing the background color for the buttons and customized code for the center text.  Should look like below image.

 

but anyway what I would like to do is trigger the word "narrative" when the corresponding image is hovered on.  This is actually a really annoying change with 7.1 fluid engine.  In classic, when one could just use a "poster" effect for the image - all of it could be affected with one piece of code for that block.  Now that they are separate blocks, it makes it much more complicated.

Screen Shot 2022-12-01 at 8.22.52 AM.png

Link to comment

To set another element when hovering another element, we can use the javascript to handle the action of hovering element.

By the way, have your tried using the list section to create this layout?

image.thumb.png.4706b0aaacf7029d8e05b15af3799b26.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
2 hours ago, Beyondspace said:

To set another element when hovering another element, we can use the javascript to handle the action of hovering element.

By the way, have your tried using the list section to create this layout?

image.thumb.png.4706b0aaacf7029d8e05b15af3799b26.png

The List selection doesnt have flexibility for text placement or movement to recreate what I've already made.

Im best versed in html and css.  Javascript is new for me - would you be able to help me out with that?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.