Javascript library enabling magnifying glass effect on an images

Related tags

Effect Magnifier.js
Overview

Magnifier.js

Javascript library enabling magnifying glass effect on an images.

Demo and documentation

Features:

  • Zoom in / out functionality using mouse wheel
  • Setting options via Javascript or data attributes
  • Magnified image can be displayed in the lens itself or outside of it in a wrapper
  • Attachment to multiple images with single call
  • Attachment of user defined functions for thumbnail entering, moving and leaving and image zooming events
  • Display loading text while the large image is loading, and switch to lens once its loaded

Magnifier.js requires Event.js package, which can be acquired at the following links:

Browser Compatibility

Currently tested in:

  • Chrome 24
  • Firefox 18
  • IE 7, 8, 9, 10
  • Safari for Windows 5.1.7

Bug tracker

Have a bug? Please create an issue here on GitHub!

https://github.com/mark-rolich/Magnifier.js/issues

Copyright and License

The MIT License (MIT)

Copyright (c) 2013 Mark Rolich

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Comments
  • [Feature Request] New feature for Magnifier.js

    [Feature Request] New feature for Magnifier.js

    Hi,

    I have used your library and I must say it is awesome and really neat. But there is one issue. Basically not a technical issue just consider it as a new feature request.

    Right now Magnifier.js is working on showing original image as thumbnail and then displaying original image and setting background property using JavaScript. This is perfectly valid. But there are some situations in which I want to show users the original image in it's original form and then giving some zooming ability. I think Magnifier.js will not help me in this.

    Please! take a look at my library http://i8ecoders.com/my_image_zoomer/ which is showing zoomed version of original image in HTML5 Canvas. It is not perfect but I can make it working 100% fine within 01 hour max.

    Is their any chance that we can integrate my library after perfecting it up with your library for the above said effect. I was aiming to launch this as a jQuery Plugin but didn't get time but I really like your Library and I would love to hear your thoughts.

    Looking forward to hear from you.

    Thanks.

    feature request 
    opened by ilatif 7
  • onthumbleave fires everywhere and forever outside the thumb

    onthumbleave fires everywhere and forever outside the thumb

    Hi! I've found a possible bug: onthumbleave keeps firing forever outside the thumb. Not initially, but after an onthumbenter event.

    I think it's simply not fully controlled by the relative function (row 550). It should fire once.

    You can see by simply plug a log on your last demo.

    Regards

    opened by stratboy 2
  • Add options to define zoom min and zoom max if zoomable is enabled.

    Add options to define zoom min and zoom max if zoomable is enabled.

    Love this JS plugin btw!

    When I enabled the zoomable boolean, I found myself zooming in indefinitely. I added a zoomMax option so that there is a hard limit in how much I can zoom in. Also while I was at it, I added a zoomMin option so that both zoom boundaries can be defined.

    opened by jessewang-arvatosystems 1
  • Uncaught TypeError: Cannot read property 'id' of undefined

    Uncaught TypeError: Cannot read property 'id' of undefined

    I'm initializing Magnifier.js like this:

    var evt = new Event(),
    m = new Magnifier(evt);
    m.attach({
        thumb: '.slide-thumb',
        largeWrapper : 'zoomy'
    });
    

    This is my HTML markup:

    <a href="path-to-image.jpg" class="magnifier-thumb-wrapper">
       <img class="slide-thumb" src="path-to-image.thumb.jpg" data-large-img-url="path-to-image.jpg" alt="xxxx" itemprop="image">
    </a>
    <div id="zoomy" class="magnifier-preview" style="width: 200px; height: 133px;border:1px solid;"></div>
    

    And all I get is this error: Uncaught TypeError: Cannot read property 'id' of undefined - magnifier.js line 41. Inspecting that line, it seems as magnifier expects a DOM object and not anid` of the node as it seems to be suggested in documentation (and as done in demo).

    To fix it I got change line 41 to:

    largeWrapperId: gOptions.largeWrapper? (gOptions.largeWrapper.id || null):null,
    

    So now even if you don't pass options to Magnifier constructor it won't fail.

    opened by pherrymason 1
  • Update Event.js

    Update Event.js

    Change function name so that it no longer conflicts with Bootstrap5 (causing Navbar to stop working). Note: magnifier's initialisation should change accordingly, i.e. let evt = new Magnifier_event(); let m = new Magnifier(evt); m.attach(...); ...

    opened by fxie520 0
  • Lens background-image distorted

    Lens background-image distorted

    The image of the lens setted as the lens background-image seems to distort due to css classes at image to be sized.

    Captura de Pantalla 2021-04-06 a la(s) 13 17 08 Captura de Pantalla 2021-04-06 a la(s) 13 17 41

    Image seems to work properly if thus classes is removed (as well as the css properties of the class) as the image uses the real width x height of the file (overflows from red border-box line)

    Captura de Pantalla 2021-04-06 a la(s) 13 18 44 Captura de Pantalla 2021-04-06 a la(s) 13 19 00

    opened by nxaxg 1
  • Code doesn't seem to work at all for me.Help !

    Code doesn't seem to work at all for me.Help !

    The code :

    var evt = new Event(), m = new Magnifier(evt, { thumb: '#img', mode: 'inside', zoom: 3, zoomable: true });

    doesn't seem to work on the images I have defined inside my template even when I have called the Magnifier.js and event.js along with the css file as well. Please can someone help?

    opened by iriyagupta 0
  • [Feature Request] ability to resize lens for inner magnification

    [Feature Request] ability to resize lens for inner magnification

    @mark-rolich I'm still getting caught up so I'm not sure if this is already implemented and not documented or if its a feature that wasn't considered at the time. But is there, or will there be, a way to resize the lens for people who chose to use the mode: inside? I'd like to use it as the code is clean and simple to implement, but the viewport on the lens is nowhere near large enough for what I wish to use it for.

    The other consideration I've given to the situation is that the viewport is proportional to the large image being used, at which point one would need an inefficiently large image to make the viewport worth using on mode: inside.

    Is this project still being supported?

    Thank you for your time and response.

    opened by kcddagger 0
  • Jump lens and zoom image 1 px (if drawn bottom to top and draw right to left)

    Jump lens and zoom image 1 px (if drawn bottom to top and draw right to left)

    Excuse me for the translator...

    If you move the cursor from bottom or from right to the center. Then reaching the middle of the lens size, the lens will return back down by 1 pixel or to the right by 1 pixel. The cursor is drawn from the bottom to the top, or tight to left.

    I really liked your lens, I want to use it, but this jump is annoying

    opened by VasiliyKozhevnikov 0
Owner
Mark Rolich
Mark Rolich
A subtle tilt effect for images. The idea is to move and rotate semi-transparent copies with the same background image in order to create a subtle motion or depth effect.

Image Tilt Effect A subtle tilt effect for images. The idea is to move and rotate semi-transparent copies with the same background image in order to c

Codrops 571 Nov 21, 2022
Liquideffect - Javascript Library for creating liquid effect on image and RGB effect on mouse direction.

LiquidEffect Javascript Library for creating liquid effect on image and RGB effect on mouse direction. Demo https://liquideffect.netlify.app/ Dependen

Rohail 8 May 6, 2022
A motion hover effect for a background grid of images.

Image Grid Motion Effect A motion hover effect for a background grid of images. Article on Codrops Demo Installation Install dependencies: npm install

Codrops 118 Dec 31, 2022
Animated haze distortion effect for images and text, with WebGL.

Animated Heat Distortion Effects with WebGL A tutorial on how to use fragment shaders in WebGL to create an animated heat haze distortion effect on im

Lucas Bebber 289 Nov 1, 2022
Add a retro/vintage effect to images using the HTML5 canvas element

vintageJS Add a retro/vintage effect to images using the HTML5 canvas element. Installation $ npm install vintagejs How to use vintagejs is a functio

Robert Fleischmann 829 Dec 25, 2022
A tutorial on how to create a thumbnail grid with an expanding image preview similar to the effect seen on Google Images.

Thumbnail Grid with Expanding Preview A tutorial on how to create a thumbnail grid with an expanding image preview similar to the effect seen on Googl

Codrops 353 Jan 4, 2023
A jQuery plugin that displays a thumbnail grid expanding preview similar to the effect seen on Google Images.

jQuery GRIDDER 1.4.2 ======= A jQuery plugin that displays a thumbnail grid expanding preview similar to the effect seen on Google Images. We have all

Orion Gunning 455 Nov 6, 2022
"shuffle-text" is JavaScript text effect library such as cool legacy of Flash.

ShuffleText This is the JavaScript library for text effect such as Flash contents. Setup Script Install <script src="shuffle-text.js"></script> NPM In

Yasunobu Ikeda 96 Dec 24, 2022
Javascript and SVG odometer effect library with motion blur

SVG library for transitioning numbers with motion blur JavaScript odometer or slot machine effect library for smoothly transitioning numbers with moti

Mike Skowronek 793 Dec 27, 2022
🎨 Aquarelle is a watercolor effect component. Javascript library by @Ramotion

Aquarelle About This project is maintained by Ramotion, Inc. We specialize in the designing and coding of custom UI for Mobile Apps and Websites. Look

Ramotion 1.8k Dec 9, 2022
Javascript library to draw and animate images on hover

Hover effect Javascript library to draw and animate images on hover. If this project help you, you like this library or you just want to thank me, you

Robin Delaporte 1.5k Dec 23, 2022
Pure CSS Image Hover Effect Library

imagehover.css A Scaleable & Light Image Hover CSS Library Imagehover.css is a lovingly crafted CSS library allowing you to easily implement scaleable

Ciaran Walsh 1.8k Dec 21, 2022
⌨️ A tiny library for creating a typing effect on specified text element.

⌨️ TinyTyper - a tiny library for creating a typing effect on specified text element. Demo Size (It's really tiny) Minimized: 2.9KB Gziped: 1.1KB Inst

Korney Vasilchenko 175 Sep 29, 2021
A simple yet powerful native javascript plugin for a cool typewriter effect.

TypewriterJS v2 NPM Repository JSFiddle Example Emoji Example CDN You can use the CDN version of this plugin for fast and easy setup. <script src="htt

Tameem Safi 1.8k Jan 4, 2023
:keyboard: Simulate a typewriter effect in vanilla JavaScript.

malarkey Simulate a typewriter effect in vanilla JavaScript. Flexible API allowing granular control Option to repeat the sequence indefinitely Allows

Yuan Qing Lim 237 Nov 18, 2022
Enterprise-grade JavaScript snow effect for the internets, setting CPUs on fire worldwide every winter since 2003.

/** * DHTML Snowstorm! JavaScript-based Snow for web pages * -------------------------------------------------------- * Version 1.44.20131208 (Prev

Scott Schiller 518 Dec 24, 2022
Small but good javascript smoke effect 🌬💨

Demo You can play with a live demo here → Installation Basic Copy the smoke.js file into your project and use it with a script tag: <script src="smoke

Guillermo Webster 239 Dec 28, 2022
Cool and powerful effect to select fields. Javascript vanilla and ~2kb gzipped

pickout Cool and powerful effect to select fields. Javascript vanilla and ~2kb gzipped. DEMO PAGE For syntax of the previous version click here How to

Alan Ktquez 89 Sep 20, 2022
Javascript Sound Effect Generator

This is a JavaScript library for sound effect generation and is supported on most current browsers. Generation speed is approximately 1s audio = 10ms

Loov 567 Oct 31, 2022