ConnorSW Posted March 6, 2020 Share Posted March 6, 2020 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"> <head> <meta charset="utf-8"> <title>Image Swap on Hover with CSS</title> <style> .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; } </style> </head> <body> <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"> </div></a> </body> </html> Link to comment
tuanphan Posted March 6, 2020 Share Posted March 6, 2020 CSS hover won't work on Mobile. You need to use JavaScript in this case (complicated) 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
ConnorSW Posted March 7, 2020 Author Share Posted March 7, 2020 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
e2astudio Posted March 7, 2020 Share Posted March 7, 2020 On 3/6/2020 at 6:52 AM, ConnorSW said: The code below is the one im using: Where are you placing this code? Why is it an entire HTML document? Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.