jQuery plugin for zooming images on mouseover.

Related tags

Maps zoom
Overview

About Zoom

A small jQuery plugin for zooming images on mouseover or mousedown. See the project page for documentation and a demonstration. Released under the MIT license.

To compile the .min.js file, run: uglifyjs --comments '/license:/' < jquery.zoom.js > jquery.zoom.min.js

Changelog:

v1.7.21 - 2018/4/26
  • Added empty alt attribute. Resolves #134
v1.7.20 - 2017/4/25
  • Replaced alt and aria-hidden with role attribute. Resolves #121
v1.7.19 - 2017/4/20
  • Added alt and aria-hidden attributes to the zoom layer img element. Merged #121
v1.7.18 - 2016/9/9
  • Fixed regression from 1.7.16 that occurred when the target option was passed a selector. Fixes #113
v1.7.17 - 2016/9/7
  • Detect src using element.currentSrc to support srcset. Fixes #82
v1.7.16 - 2016/9/7
  • Cancelled the onload event when calling destroy. Fixes #83
v1.7.15 - 2016/2/8
  • Added touchend event, might fix #97 #75 #62. Merges #100.
v1.7.14 - 2015/3/18
  • Fixes bug with passing the target property a selector, rather than a DOM node. Merges #73.
v1.7.13 - 2014/4/29
  • Destroy event does a better job of reseting back to the original state.
v1.7.12 - 2014/2/11
  • Set zoomed image's maxHeight to none, just in case a maxHeight has been defined for images in the CSS.
v1.7.11 - 2013/11/12
  • Added magnify property to allow scaling of the zoomed image.
v1.7.10 - 2013/10/16
  • Fixed bug relating to the size of the target element when using the target property (Fixes #35)
v1.7.9 - 2013/10/16
  • Added simple fallback for touch events (Fixes #37 #39)
  • Renamed minified file to jquery.zoom.min.js to match jQuery's convention.
v1.7.8 - 2013/7/30
  • Will use data-src attribute if present before checking for the presence of an src attribute.
v1.7.7 - 2013/7/14
  • Restricted grab to just the left-mouse-button on mousedown
v1.7.6 - 2013/6/24
  • Fixed misnamed onZoomOut callback
v1.7.5 - 2013/6/19
  • Fixed a bug with absolutely or fixed position target elements
  • Set the value of this to be zoom-image element for the onZoomIn and onZoomOut callbacks
v1.7.4 - 2013/6/18
  • Namespaced events to assist unbinding events.
  • Added destroy event to unbind zoom events & remove created img element. Example: $('.example').trigger('zoom.destroy');
  • Added onZoomIn and onZoomOut callbacks
v1.7.3 - 2013/6/10
  • Fixing mistake made in previous commit
v1.7.2 - 2013/6/6
  • Replaced new Image() with document.createElement('img') to avoid a potential bug in Chrome 27.
v1.7.1 - 2013/3/12
  • Replaced jQuery shorthand methods with on() in anticipation of jQuery 2.0
v1.7.0 - 2013/1/31
  • Added 'toggle' behavior to zoom in/out on click. Example: $('#example').zoom({ on:'toggle' });
  • Removed the icon property in favor of just using CSS.
v1.6.0 - 2013/1/22
  • Created $.zoom which contains the positioning logic, so that users can write custom controls or event handling.
v1.5.0 - 2012/11/19
  • Added 'target' property for specifying the element that displays the zoomed image.
v1.4.0 - 2012/9/29
  • Changed API & added option to activate on click.
v1.3.0 - 2011/12/21
  • Added 'callback' property that will execute a callback function once the image has loaded.
  • Fixed a bug relating to the 'grab' property
v1.2.0 - 2011/11/15
  • Fixed a positioning bug
v1.1.0 - 2011/11/15
  • Added 'grab' property
v1.0.0 - 2011/11/11
  • First release
Comments
  • Zooming only on some pictures

    Zooming only on some pictures

    Hi can you take a look here: http://openbci.com/index.php/gettingstarted

    Only the picture at the bottom of the page will zoom.

    I checked in the console and Zoom shows up on every element.

    At first I thought it was because the last picture was the only .jpg and all the rest are .png, but I changed one of the others to .jpg and still no zoom.

    Thanks for any help.

    opened by gmuse 9
  • Destroy doesn't work

    Destroy doesn't work

    When I run the

    $('#example').trigger('zoom.destroy');

    on any element e.g.:

    $('#button').click('zoom.destroy');

    I get the following error:

    Uncaught TypeError: ((jQuery.event.special[handleObj.origType] || (intermediate value)).handle || handleObj.handler).apply is not a function(…)

    opened by balawton 7
  • fix errors on IE8 because of img.style.left/top not available

    fix errors on IE8 because of img.style.left/top not available

    Hi there. Nice plugin. I fixed an error on IE8 real quick for you with this patch. I will send you a link to my site when it launches - your plugin works really well. Thanks.

    opened by cmwelsh 6
  • Zoom applied exponentially after being called several times even with a $.remove()

    Zoom applied exponentially after being called several times even with a $.remove()

    I have a Marionette function that is called every time a user changes product color. This will enable the zoom of that product color image as well as other locations of that color. In this case, every time I apply a zoom, the zoom applies exponentially. The destroy trigger seems to only destroy the img that it is created once so I tried using $.remove().

    this.ui.current_image.find('.js-zoomable-image').each(function(){
            var $this = $(this);
            var url = $this.data('large-url');
            $this.find('img.zoomImg').remove();
            $this.zoom({ url: url, touch:touch_val });
          });
    

    I figured that every time this function is going to be called, I could remove all the original zooms and then reapply it. However it will start with 2, 4, 6, 12, etc..

    What am I doing incorrectly?

    opened by reidcooper 5
  • Zoom acting strange after changing src, tried everything

    Zoom acting strange after changing src, tried everything

    Hi, the jZoom is working flawless on a single picture but as soon as I change the SRC and re-call the zoom then the pictures just moves a little bit when I hover with my mouse over it, but it does not zoom in.

    I tried every solution I found on GIT and the internet but nothing worked for me so far. I hope you, or anyone else who reads this can help me out.

    The javascript that I wrote and the container in which the image rests:

    <div class="product-details-images">
        <div class="product-details-images_big bigImage" data-image="<?php echo $mainimg?>">
            <a href="<?php echo $g_oProduct->ImageName(3,$alt);?>" title="<?php echo $g_oProduct->Title();?>">
                <img src="<?php echo $mainimg?>" alt="<?php echo $alt_text; ?>" height="400" height="800" itemprop="image" />
            </a>
        </div>    
    </div>
    
    *** thumbnails are here ***
    opened by Ometecuthli 5
  • Touch to zoom on mobiles

    Touch to zoom on mobiles

    The zoom works on mobiles and touch event, although there is one slight issue ( minor feature request? ;) which I feel would make it more user friendly. The problem is that the zoom stays "zoomed" even after I've finished touching the mobile. It would be much nicer if the image had zoomed back out to the original state, so that it can be zoomed again easily, while currently it requires two touches to zoom again.

    opened by avenicus 5
  • Adding an empty alt attribute for accessibility validation

    Adding an empty alt attribute for accessibility validation

    Accessibility validation tools will report an error because the zoomed image created does not contain a required alt attribute. I've set it to an empty string.

    opened by adevendorf 4
  • target option fix: replacing JS 'style' with jQuery 'css'

    target option fix: replacing JS 'style' with jQuery 'css'

    Target option was broken.

    target: 'selector'
    

    On some places it was used as jQuery object $(selector), and on some places as DOM element selector.style - bug, selector is string, it can't be used like this.

    Fixed by changing all to jQuery object.

    Target is working fine now.

    Thanks, Dragan

    opened by easingthemes 4
  • Installation instructions

    Installation instructions

    I see that you (or someone) have hosted files on jsDelivr CDN I don't see any installation instructions anywhere, so I'm not sure if they are needed. If that file is needed, I would assume that it would be included inside the JavaScript file to reduce HTTP requests.

    opened by tomByrer 4
  • integrate with flexslider

    integrate with flexslider

    I'm using the exact setup referenced here http://flexslider.woothemes.com/thumbnail-slider.html

    I call zoom on ".flex-active-slide". It works on first load but when the image changes the zoom function doesn't

    opened by zzramesses 4
  • Added a toggle setting, updated demo to reflect the toggle, updated event listener syntax to jquery 1.9.0

    Added a toggle setting, updated demo to reflect the toggle, updated event listener syntax to jquery 1.9.0

    I was unfamiliar with the document binding syntax that you were using. $(document)mousemove;

    Is there benefit to this syntax that I'm missing out on by using jQuery's .on() or .bind/delegate/live methods? Or is it just an alternative syntax?

    Great work, loved how easy it was to read and customize!

    opened by anonymousandrew 4
  • Not Working in angular - $img.stop()

    Not Working in angular - $img.stop()

    Hi Jack i've been trying to use in Angular but im having an issue with events and zooming. I get an error every time i mouse over it

    ERROR TypeError: $img.stop is not a function at HTMLDivElement.stop (jquery.zoom.js:121) at HTMLDivElement.handle (jquery.slim.min.js:2) at HTMLDivElement.dispatch (jquery.slim.min.js:2) at HTMLDivElement.v.handle (jquery.slim.min.js:2) at ZoneDelegate.invokeTask (zone-evergreen.js:406) at Object.onInvokeTask (core.js:28521) at ZoneDelegate.invokeTask (zone-evergreen.js:405) at Zone.runTask (zone-evergreen.js:178) at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:487) at invokeTask (zone-evergreen.js:1600)

    And core.js:6157 ERROR TypeError: $img.stop is not a function at HTMLDivElement.start (jquery.zoom.js:130) at HTMLDivElement.handle (jquery.slim.min.js:2) at HTMLDivElement.dispatch (jquery.slim.min.js:2) at HTMLDivElement.v.handle (jquery.slim.min.js:2) at ZoneDelegate.invokeTask (zone-evergreen.js:406) at Object.onInvokeTask (core.js:28521) at ZoneDelegate.invokeTask (zone-evergreen.js:405) at Zone.runTask (zone-evergreen.js:178) at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:487) at invokeTask (zone-evergreen.js:1600)

    I already imported jquery in angular and also the plugin.

    This is the way i use it. //Component.ts ngOnInit(): void { jQuery(document).ready(function($){ ( $('#ex1') as any) .zoom(); });

    opened by LinoMacKay 0
  • Show a smaller image (logo) on top of the preview image?

    Show a smaller image (logo) on top of the preview image?

    How would you show a smaller image on top of the preview image after zooming in? Would I need to programmatically combine them first into a single image before showing it?

    opened by ItsDanielHarris 1
  • Cannot set property 'zoom' of undefined in vue

    Cannot set property 'zoom' of undefined in vue

    import $ from "jquery";
    import "jquery-zoom";
    

    i am importing package then i get this error: Cannot set property 'zoom' of undefined. what can i do?

    opened by hahuaz 1
  • Important accessibility issue! No alt text

    Important accessibility issue! No alt text

    Hi! I see that this has been filed previously (#134 ) - but it's pretty crucial (for me at least) to solve, as I'm being sued for accessibility non-compliance (my site uses Shopify, Shopify's theme uses this plugin).

    https://github.com/jackmoore/zoom/blob/master/jquery.zoom.js#L92

    Seems like the plugin creates a new image element based off the source. Can we get the plugin to copy over the alt text?

    opened by heaversm 1
Owner
Jack Moore
Long bio enthusiast
Jack Moore
Downloads satellite images from Google Maps, only slightly illegal.

Google Maps Satellite Downloader This is a script to download satellite images from Google Maps. The below mentioned optimization system requires that

null 5 Oct 31, 2022
This is the leaflet plugin for GeoServer. Using this plugin user can have access to wms and wfs request easily.

Documentation leaflet-geoserver-request This is the plugin for Geoserver various kind of requests. Using this plugin, we can make WMS, WFS, getLegendG

Tek Kshetri 127 Dec 15, 2022
Dashboards-maps is a frontend plugin that helps you in uploading custom GeoJSON to OpenSearch and communicates with the geospatial backend plugin for the same.

Welcome! Project Resources Code of Conduct License Copyright Dashboards-Maps Dashboards-maps is a frontend plugin that helps you in uploading custom G

null 9 Dec 28, 2022
jQuery Vector Map Library

This project is a heavily modified version of jVectorMap as it was in April of 2012. I chose to start fresh rather than fork their project as my inten

10 Best Design 1.8k Dec 28, 2022
jQuery Vector Map Library

This project is a heavily modified version of jVectorMap as it was in April of 2012. I chose to start fresh rather than fork their project as my inten

10 Best Design 1.8k Dec 28, 2022
Medium's Image Zoom for jQuery

ZOOM.JS A simple jQuery plugin for image zooming; as seen on Medium. Demo https://fat.github.io/zoom.js How Link the zoom.js and zoom.css files to you

fat 4.1k Jan 2, 2023
Mapbox JavaScript API, a Leaflet Plugin

mapbox.js A Mapbox plugin for Leaflet, a lightweight JavaScript library for traditional raster maps. For the state-of-the-art Mapbox vector maps libra

Mapbox 1.9k Dec 23, 2022
🏸 A simple plugin for image zooming without dependencies ~1.65KB gzip

ZOOOM.JS A simple plugin for image zoooming without dependencies. Only pure javascipt. Installation CDN JavaScript <script src="https://cdn.jsdelivr.n

Grzegorz Tomicki 13 Aug 30, 2022
Demos for the tutorial on how to achieve an interactive mouseover/hover effect

Interactive Hover Effects with Three.js A simple tutorial on how to achieve an interactive mouseover/hover effect on images in some easy steps. Articl

Yuri Artiukh 246 Dec 27, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A library for panning and zooming elements using CSS transforms :mag:

Panzoom Examples Panzoom is a small library (~3.7kb gzipped) to add panning and zooming functionality to an element. Rather than using absolute positi

Timmy Willison 1.8k Dec 26, 2022
jQuery plugin for 'responsive cropping'. Dynamically crop images to fill available space without cutting out the image's subject. Great for full-screen images.

jQuery plugin for 'responsive cropping'. Dynamically crop images to fill available space without cutting out the image's subject. Great for full-screen images.

Jono Menz 3.2k Dec 30, 2022
Simple jQuery plugin that will allow users to zoom in your images, perfect for product images and galleries.

Image Zoom (jQuery) Plugin Simple jQuery plugin that will allow users to zoom in your images, perfect for product images and galleries that is less th

Mario Duarte 8 Aug 3, 2022
Compare James Webb Space Telescope images to older images.

How much more powerful is the James Webb Space Telescope when compared to Hubble? Find out! More info Want to help out? CONTRIBUTING.md Blog post with

John Christensen 399 Jan 3, 2023
Easiest 1-click way to install and use Stable Diffusion on your own computer. Provides a browser UI for generating images from text prompts and images. Just enter your text prompt, and see the generated image.

Stable Diffusion UI Easiest way to install and use Stable Diffusion on your own computer. No dependencies or technical knowledge required. 1-click ins

null 3.5k Dec 30, 2022
MidJourney is an AI text-to-image service that generates images based on textual prompts. It is often used to create artistic or imaginative images, and is available on Discord and through a web interface here.

Midjourney MidJourney is an AI text-to-image service that generates images based on textual prompts. It is often used to create artistic or imaginativ

Andrew Tsegaye 8 May 1, 2023