Jump to content

Solution for sticky hover issue on mobile screens

Recommended Posts

site: https://www.amethystwallgallery.com/

pass: Help123!

The target for this solve is the "Add To Cart" button found in any product item in the store.

I am trying to have a :hover effect only on the desktop version of my site, and an :active effect on the mobile version of my site, without using pixel breakpoints. With my limited experience with CSS, I have tried a couple of things such as:

Quote

@media (hover: hover) {
     .button:hover {
          opacity:0.5;
          transition: opacity 150ms ease-in-out
          }}
@media (hover: none) {
     .button:active {
          opacity:0.5;
          transition: opacity 150ms ease-in-out
          }}
.button {
     opacity:1;
     transition: opacity 150ms ease-in-out
     }

I have also tried without a media query:

Quote

.button:hover, .button:active {
     opacity:0.5;
     transition: opacity 150ms ease-in-out
     }
.button {
     opacity:1;
     transition: opacity 150ms ease-in-out
     }

In both cases, the button functions as intended on desktop but I still get sticky hover on mobile. I have reached my knowledge limit with CSS, please enlighten me!

Link to comment
  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

4 hours ago, amethystwallgallery said:

site: https://www.amethystwallgallery.com/

pass: Help123!

The target for this solve is the "Add To Cart" button found in any product item in the store.

I am trying to have a :hover effect only on the desktop version of my site, and an :active effect on the mobile version of my site, without using pixel breakpoints. With my limited experience with CSS, I have tried a couple of things such as:

I have also tried without a media query:

In both cases, the button functions as intended on desktop but I still get sticky hover on mobile. I have reached my knowledge limit with CSS, please enlighten me!

On mobile, we do not have the action of hover, we only have the touch event to work around. So the code for hover will not work on mobile

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment
10 minutes ago, Beyondspace said:

On mobile, we do not have the action of hover, we only have the touch event to work around. So the code for hover will not work on mobile

Yeah I am aware of this, maybe I haven't worded it right, I have autism so communication isn't my strong point   : /

Basically:

  • I'd like to have CSS code so that a :hover effect (to 0.5 opacity) that is limited only to hover-supported versions of my site
  • On devices where hover is NOT supported, I would like to have an :active effect (to 0.5 opacity) instead. Kind of like emulating the :hover effect of the desktop site, but just for the duration of a touch event, like when someone taps a screen.

Is this possible to code in?

Link to comment
11 minutes ago, amethystwallgallery said:

Yeah I am aware of this, maybe I haven't worded it right, I have autism so communication isn't my strong point   : /

Basically:

  • I'd like to have CSS code so that a :hover effect (to 0.5 opacity) that is limited only to hover-supported versions of my site
  • On devices where hover is NOT supported, I would like to have an :active effect (to 0.5 opacity) instead. Kind of like emulating the :hover effect of the desktop site, but just for the duration of a touch event, like when someone taps a screen.

Is this possible to code in?

- On desktop, i check that the opacity transition Css code when hovering is working now. Do you still need any other help?

- On mobile display, we need to implement javascript code, which is only available on Business Plan/ above ones, so with some code we can control the touch events

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment
5 minutes ago, Beyondspace said:

- On desktop, i check that the opacity transition Css code when hovering is working now. Do you still need any other help?

- On mobile display, we need to implement javascript code, which is only available on Business Plan/ above ones, so with some code we can control the touch events

The hover works as intended on desktop, but still sticks on mobile even if I use @media (hover: hover)

I believe I have the basic commerce package so Javascript should be available to me, what code should I use? I am even more unfamiliar with Javascript.

If possible I would like a pure CSS fix but that is down to my desire to use just one code language, for no other reason than it would be very satisfying haha

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.