Jump to content

Hover animation

Go to solution Solved by tuanphan,

Recommended Posts

Hey there, I've had a CSS code for hover animation in my 7.0. After moving it to 7.1 the code is no longer working

At the bottom of every page like https://www.justinphang.com/nike-hk, there's a gallery that users can navigate to the next page.

image.thumb.png.bebde61cdc0f97a1add3b34e15e179da.png

 

Here's the previous code, can it still work with modifications?

// Hover animation in Thumbnail Gallery block //
a img.thumb-image {
   display: inline-block;
   vertical-align: middle;
   -webkit-transform: translateZ(0);
           transform: translateZ(0);
   box-shadow: 0 0 5px rgba(0, 0, 0, 0);
   -webkit-backface-visibility: hidden;
           backface-visibility: hidden;
       -moz-osx-font-smoothing: grayscale;
   -webkit-transition-duration: 0.3s;
           transition-duration: 0.3s;
   -webkit-transition-property: transform;
           transition-property: transform;
 }
 a img.thumb-image:hover,
 a img.thumb-image:active {
   -webkit-transform: scale(1.1);
           transform: scale(1.1);
 }
[id*='index-section']:hover img {
    transform: scale(1.1);
    transition: all .3s ease;
}

Learning something new everyday

Link to comment
  • Replies 8
  • Views 1.7k
  • Created
  • Last Reply

Top Posters In This Topic

  • Solution

Hover image >> Make image bigger?

or

Hover image >> Make image bigger + overlay?

If (1), use this code

div#block-9723e7a713f8cb0b0794 {
.slide:hover img {
    transform: scale(1.1);
    transition: all .3s ease;
}
img {
    transition: all 0.3s ease;
}}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

This is great! Anyway to make this work for all pages?

I use this gallery block as a form of index page at the bottom of every page, for example here: https://www.justinphang.com/wr-supreme-cell and here https://www.justinphang.com/google-mana

And you're correct, I just want to make it bigger. But out of curiousity, if its enlarge + overlay, what kind of CSS will it be?

Edited by justin_phang
added in clarification to reply

Learning something new everyday

Link to comment

#1. Use this code

.slide:hover img {
    transform: scale(1.1);
    transition: all .3s ease;
}
img {
    transition: all 0.3s ease;
}

#2. Use this

.slide:after {
    position: absolute;
    content: "";
    background: rgba(0,0,0,0.5);
    z-index: 999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: all 0.5s;
}
.slide:hover:after {
    opacity: 1;
    transition: all 0.5s;
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Thank you Tuanphan as always! Though after applying this code I realized all the other gallery blocks are affected. Seems like targetting manually on the gallery block in each of the page is the way around it (like your first solution), do you have any other suggestions?

Learning something new everyday

Link to comment

To apply code to one page, just edit page > Add a Code Block > Paste the code

<style>
  .slide:after {
    position: absolute;
    content: "";
    background: rgba(0,0,0,0.5);
    z-index: 999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: all 0.5s;
}
.slide:hover:after {
    opacity: 1;
    transition: all 0.5s;
}
</style>

(CSS in Code Block, need to wrap in <style> and </style>)

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

If target specific block, use this code instead, but add to Custom CSS box

#enter-gallery-block-id {
 .slide:after {
    position: absolute;
    content: "";
    background: rgba(0,0,0,0.5);
    z-index: 999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: all 0.5s;
}
.slide:hover:after {
    opacity: 1;
    transition: all 0.5s;
}
}

Use this free tool to find id

https://chrome.google.com/webstore/detail/squarespace-id-finder/igjamfnifnkmecjidfbdipieoaeghcff

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

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.