MooTools Zoomer Plugin

By on  

MooTools Image Zoom

I love to look around the MooTools Forge. As someone that creates lots of plugins, I get a lot of joy out of seeing what other developers are creating and possibly even how I could improve them. One great plugin I've found is Zoomer by Anton Samoylov. Zoomer provides an elegant method for zooming in on large images.


<img src="cricci.jpg" alt="Muse: Christina Ricci" big="cricci-large.jpg" id="ricci" />

Note the big attribute within the image is where the you place the path to the larger image. This is the default usage of the plugin -- you may also provide the path to the larger image within the plugin instance options object.

The MooTools JavaScript

window.addEvent('domready',function() {
	new Zoomer('ricci',{ 
		smooth: 10/*,
		big: 'cricci-large.jpg' */

Using Zoomer is as easy as the code above -- simply provide the ID of the image and the custom smooth setting. As mentioned above, you may also define the larger image path within the instance.

Sweet huh? My praise goes out to Anton for his excellent plugin. I love how easy this plugin is to implement. Remember though -- Zoomer is just one of hundreds of quality plugins in the MooTools Forge. Are your plugins in the Forge?

Track.js Error Reporting

Recent Features

  • Create a CSS Flipping Animation

    CSS animations are a lot of fun; the beauty of them is that through many simple properties, you can create anything from an elegant fade in to a WTF-Pixar-would-be-proud effect. One CSS effect somewhere in between is the CSS flip effect, whereby there's...

  • How to Create a Twitter Card

    One of my favorite social APIs was the Open Graph API adopted by Facebook.  Adding just a few META tags to each page allowed links to my article to be styled and presented the way I wanted them to, giving me a bit of control...

Incredible Demos


  1. doxe

    Great & useful plugin !
    Is there any chance to have an equivalent plugin working with jQuery ?

  2. Thats really neat!

  3. very very neat, nice fade effect when you mouseout. Nice Anton Samoylov and DW, MT FTW!

  4. very nice effect

  5. Awesome indeed!

  6. olivier

    Nice, I like this effect much better than the usual zoom effect with a small zoom box on top the the original image

  7. deef

    smooth effect, though I think you should be adding a CR-category by now…

  8. hamburger

    Hello David,
    thats really gorgeous.
    May be you can show us how this works with your nina ricci slide-show.

  9. way to go…. I must want to include/use it on my photography site

  10. quote doxe, exist plug-in jquery? :)

  11. Hello David,

    Nice script!

    Just a tiny comment on mouse events :)

    From usability point of view, i believe it will be better to disable click and drag when you mouse over to zoom.

    Usually people are not getting into the meaning of new type of cursor, so they click and often click and drag.

    In you script when you mouse over and click, so the thumb appears over the large(zoomed) image.

    Here is a screen-shot http://i.imgur.com/PSjLJ.jpg

    I believe what you have created is greater than what i have written here and it’s maybe not important but it’s definitely usable.

    Keep up the good work!

  12. @moro: hi, work with mozilla firefox, don’t work with internet explorer 7 :(

  13. fixed ________________

  14. thanks :) very good work!!

  15. hnal

    Hi there, is there a way to change the big image via javascript ? I’m trying to build a gallery with the picture+zoom capabilities and thumbnails. But I can only change the src picture.

    This is not working :

    function changepics(ref)

    document.getElementById(‘zoom’).src = ref;
    new Zoomer(‘zoom’, {big: ref ,smooth: 10});


  16. Samarjit Sen

    Very cool and attactive

  17. Samarjit Sen

    Very cool and effective

  18. luki


    I have same problem… Have you found solution?

  19. hnal


    Hello, i’m still stuck with that issue. Nom i’m trying to reload the entire page when someone click on a thumbnail..

    And you ?

    • it’s my way. Hope will get help.
      1. keep the reference of the Zoomer instance.

      var imgZoom =  new Zoomer('mainImage');

      2.when you want to change the big picture, do this.

      imgZoom.big.set('src','path of your new big picture');
    • hnal

      Thanks for the reply! I tried your solution but I couldn’t make it work! Do you have a full exemple where it is working?

  20. guest

    great plugin!!!
    Could you change a picture for demo?
    It scare me… …

    • Try this:

      var imgZoom = new Zoomer('mainImage');
      imgZoom.big.set('src','path of your new big picture');
  21. Have an problem with this plugin, i work on rails 2.3.8 and this plugin re-submit the current page with id => ” _” … And cause an Active RecordNotFound :-/

  22. I also have similar problem, when using with prettyphoto – jquery lightbox alternative, background set as (_), applied in inline style causing problem, error and zooming doesn’t work at all.

    Pls check at this url:

    And mouse hover on first/top project box, which will open slider, and click on Location Plan. This open iframe where zoomer is implemented.

    Zooming sometimes work and sometimes not in FF.

    And in IE, it works only for the first time.

    Please help us how to fix this…


  23. Just an update that I’m not using Rail. Mine was only pure xhtml project. But this has caused error and hence zoomer doesn’t work when using prettyphoto iframe.

  24. Martin

    very nice. would that also work with image maps in the larger image?

  25. michaela


    Very nice! I like it!

    And so I’ve used it!

    But somehow it’s not working properly:
    In Mozilla Firefox it’s perfect but on IE only when viewed on my PC at home. When I upload it on the server and look at it with IE, the enlarged picture is vertically twisted.

    I have no idea why???

    I’m thankfull for any ideas

  26. Kasimir

    Perhaps worth noting: the Zoomer plugin does not work 100% with the latest MooTools 1.3 release (I’ve tried with Zoomer 1.9.3., which is the newest I could find).
    However, the fix for this is tiny:

    Line 149:

    should be:


    $clear has been deprecated, causing the stopZoom function to stop working, therefore the picture stayed zoomed.

  27. Alpinyo

    Hy David!
    Is there a way to have multiple images with zoom on one page without to have for every id or every new image a nev zoomer ? Just one class for every image.

    new Zoomer('.multipleimg');


    • Alpinyo

      I am new so I wraped in :) the

    • Alpinyo

      Hy David!

      Is there a way to have multiple images with zoom on one page without to have for every id or every new image a nev zoomer ? Just one class for every image.

      new Zoomer(‘.multipleimg’);

      img src=img1.jpg class=multipleimg big=img1big.jpg

      img src=img2.jpg class=brainstorm big=img2big.jpg

      Thanks again

      Sorry, I am posting again. I am new so please forgive my clumsiness. Maybe you could delete my older posts.

  28. ony image – one zoomer, iterate and create new Zoomer for each image.

    • Alpinyo

      Is there a way to iterate the java script code automatically every time a new image is added? (for the sake of easiness)

  29. Zenka


    i’am french, Greatulation for this script.
    I have a question please.

    It’s possible of change “id=”ricci” by the class=”ricci” ?

    i have a error her ==>

    initialize: function(element, options){
    this.small = document.id(element);

    document.id .

    Please what the code for a class ?


Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!

Recently on David Walsh Blog

  • GSAP + SVG For Power Users: Motion Along A Path

    Now that the GreenSock API is picking up steam, there are many tutorials and Getting Started guides out there to provide good introductions to the library, not to mention GreenSock’s own Forum and Documentation. This article isn’t intended for beginners, but rather a...

  • Copy a Directory from Command Line

    Copying a directory for the sake of backup is something I do often, especially when I'm trying to figure out why something isn't working when I use an external library.  I'll copy the directory structure as a backup, mess around with the original source until I find a solution,...

  • Hotjar &#8211; All-in-one Analytics and Feedback

    Website analytics are a massive business -- the more data you can collect with regard to your users' behaviors on your site, the more you can increase and maximise conversion...and increased conversion is always good.  Sometimes increase conversion means more money, improved user experience, viewer retention,...

  • Crafting a 3D React Carousel

    There is something in me that is amazed but beautiful 3D interfaces. And it doesn’t matter whether they’re functional like Gyroscope features menu, technology demonstrators like the amazing periodic table demo from famous or they’re artistic representation pushing the limits of...

  • Collaborative Editing in JavaScript: An Intro to Operational Transformation

    I've set out to build a robust collaborative code editor for the web. It’s called Codr, and it lets developers work together in real time - like Google Docs for code. For web developers, Codr doubles as a shared reactive work surface where every change is...