Streaming live at 10am (PST)

How to Implement Jack Moore's Jquery Zoom


#1

I’ve been wracking my brain for hours trying to figure out this offensively simple task, but I just can’t for the life of my implement this Jquery zoom solution in webflow. @Waldo, if you can see this, it seems like you knew the answer but the thread closed.

http://www.jacklmoore.com/zoom/

I tried every possible combination of code mixing that I could think of, but my attempts were shots in the dark at best so they aren’t any help to show.

(the old thread)
https://forum.webflow.com/t/mouseover-to-zoom-view/13995/2

Thanks to anyone that can help.


#2

Great question @wellwhy. I made a quick cloneable project for you to work with here: https://webflow.com/website/Hover-to-Zoom-image?s=hoverzoom

Basically you need to do the follow for each image:

  1. Copy the custom code from the before closing </body> tag, and the CSS for the before closing </head> tag and add that to your site.
  2. Add a div block with a class name of zoom set it to relative position and overflow: hidden for the style
  3. Then add an img inside of that block and give it a class name of zoomImg
  4. Add an ID to the zoom element holding your image of say ex1
  5. Update the code between the script tags to include your ID like this:
<script>
 $(document).ready(function(){
    	$('#ex1').zoom();
        $('#ex2').zoom();
    	});
</script>

So each time you want to add a new “zoom” block, just copy the previous “zoom” block, swap out the image and give the “zoom” element an ID.

So if you give the zoom element an ID of say monkey you would add the following code in sequence:

<script>
 $(document).ready(function(){
    	$('#ex1').zoom();
        $('#ex2').zoom();
        $('#monkey').zoom();
    	});
</script>

#3

Thanks for raising this @wellwhy and for the instructions @Waldo

Perfect timing - i’m building a store that sells fabrics - needing close-ups? Absolutely :grin:


#4

Thanks for the quick reply, this implementation worked! I must have had trouble adding the script through a link rather than local text.

I have an issue though:

Extremely inconsistently, the “zoom” will not zoom at all, and will just show the image at the same size that it was before, but still moves vertically with mouse movement.

Other times, it will work correctly and scale to the exact resolution of the image and move around. I can’t tell what causes it, whether it’s browser, incognito mode, or when I publish after changing seemingly unrelated things like the url of a link.

I can see that sometimes the page loads only the image sized down (500x500 for example), and when it works, the image is 1000x1000.

I literally DUPLICATE my project, and it works on one, doesn’t on the other, but then I open the working one in an incognito window, and it breaks again.

https://preview.webflow.com/preview/wellwhy?preview=214c6c1ff38ca237028244aca7bde500

wellwhy.webflow.io

UPDATE: Jack Moore’s zoom seems to just do weird things, and it isn’t very versatile either. I decided to implement EasyZoom instead, which I got working.

http://zoom-6924dd.webflow.io/