Jump to content

Image Hover not working on Mobile

Recommended Posts

I have used coding to achieve a hover over effect that changes the image to another image when hovered over, but for some reason none of the images display on the mobile version. and my coding knowledge isnt good enough to know if this is a coding error or just squarespace not allowing it.


The code below is the one im using:


<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>Image Swap on Hover with CSS</title>
    .card {
        width: 350px;
        height: 170px;
        position: relative;
        display: inline-block;
    .card .img-top {
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 99;
    .card:hover .img-top {
        display: inline;
    <a href="http://www.google.co.uk/"><div class="card">
        <img src="https://static1.squarespace.com/static/5e2ec9142b320c36322b1291/t/5e3d336e0e665361c45a7957/1581069167346/mtss-0858R-f.jpg
" alt="Card Back">
        <img src="https://static1.squarespace.com/static/5e2ec9142b320c36322b1291/t/5e3d33629d7664785ea5a5ce/1581069154983/mtss-0858r.jpg" class="img-top" alt="Card Front">

Link to comment
  • Replies 3
  • Views 1.4k
  • Created
  • Last Reply
22 hours ago, tuanphan said:

CSS hover won't work on Mobile. You need to use JavaScript in this case (complicated)

its less about having the effect on the mobile, but the front image doesn't even show on the mobile, it shows no image whatsoever. It works when i first put the coding in and then the image disappears over time

Link to comment


This topic is now archived and is closed to further replies.

  • 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.