CSS Product Magnification — without JavaScript

Michael Weaver
Nov 26, 2015 · 1 min read
I have a thing for plush cowboy boots

I swear I don’t have an issue with JavaScript, but sometimes I find it fun to try and replicate its use just using CSS.

This week I was working on an e-commerce website when I thought to myself, I wonder if I could swap out the bog standard JavaScript product magnification and do it with just CSS.

The idea I had was this…

  • Use a div container, with a set height and width
  • Use an image positioned absolutely to the container div
  • Use several divs to build up a grid system inside the container, which when hovered over, effect the zoom and location of the absolute image.

I’m fairly happy with the result, I wish it could be a little smoother, your feedback would be appreciated.

Update ( 30th Nov 2015 ) — Dan Cortes has taken this idea, and took it a step further, please see his blog post here.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store