jquery-zoom

Enlarge images on click or mouseover.
ad

项目文档

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

  • Added empty alt attribute. Resolves #134
  • Replaced alt and aria-hidden with role attribute. Resolves #121
  • Added alt and aria-hidden attributes to the zoom layer img element. Merged #121
  • Fixed regression from 1.7.16 that occurred when the target option was passed a selector. Fixes #113
  • Detect src using element.currentSrc to support srcset. Fixes #82
  • Cancelled the onload event when calling destroy. Fixes #83
  • Added touchend event, might fix #97 #75 #62. Merges #100.
  • Fixes bug with passing the target property a selector, rather than a DOM node. Merges #73.
  • Destroy event does a better job of reseting back to the original state.
  • Set zoomed image's maxHeight to none, just in case a maxHeight has been defined for images in the CSS.
  • Added magnify property to allow scaling of the zoomed image.
  • Fixed bug relating to the size of the target element when using the target property (Fixes #35)
  • Added simple fallback for touch events (Fixes #37 #39)
  • Renamed minified file to jquery.zoom.min.js to match jQuery's convention.
  • Will use data-src attribute if present before checking for the presence of an src attribute.
  • Restricted grab to just the left-mouse-button on mousedown
  • Fixed misnamed onZoomOut callback
  • 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
  • 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
  • Fixing mistake made in previous commit
  • Replaced new Image() with document.createElement('img') to avoid a potential bug in Chrome 27.
  • Replaced jQuery shorthand methods with on() in anticipation of jQuery 2.0
  • Added 'toggle' behavior to zoom in/out on click. Example: $('#example').zoom({ on:'toggle' });
  • Removed the icon property in favor of just using CSS.
  • Created $.zoom which contains the positioning logic, so that users can write custom controls or event handling.
  • Added 'target' property for specifying the element that displays the zoomed image.
  • Changed API & added option to activate on click.
  • Added 'callback' property that will execute a callback function once the image has loaded.
  • Fixed a bug relating to the 'grab' property
  • Fixed a positioning bug
  • Added 'grab' property
  • First release