Convert Figma logo to code with AI

jackmoore logozoom

jQuery plugin for zooming images on mouseover.

1,543
460
1,543
81

Top Related Projects

JavaScript image gallery for mobile and desktop, modular, framework independent

:zap: Simple and easy to use lightbox script written in pure JavaScript

A touchable jQuery lightbox

Full featured JavaScript image & video gallery. No dependencies

THE original Lightbox script (v2).

Quick Overview

Zoom is a lightweight JavaScript library for image zooming, as seen on Medium. It allows for smooth image zoom functionality on websites, providing an enhanced viewing experience for users when interacting with images.

Pros

  • Lightweight and easy to implement
  • No external dependencies required
  • Responsive and works well on both desktop and mobile devices
  • Customizable with various options for zoom behavior

Cons

  • Limited to image zooming functionality only
  • May not be suitable for complex image manipulation tasks
  • Requires JavaScript to be enabled in the browser
  • Limited documentation and examples available

Code Examples

Basic usage:

<img src="image.jpg" alt="Example Image" data-action="zoom">

Custom options:

Zoom.setup({
  container: '#zoom-container',
  maxZoom: 3,
  animationDuration: 300
});

Programmatically trigger zoom:

const image = document.querySelector('img');
Zoom.to(image);

Getting Started

  1. Include the Zoom script in your HTML:
<script src="https://unpkg.com/zoom-vanilla.js/dist/zoom-vanilla.min.js"></script>
  1. Add the data-action="zoom" attribute to any image you want to make zoomable:
<img src="example.jpg" alt="Zoomable Image" data-action="zoom">
  1. Initialize Zoom (optional, for custom options):
document.addEventListener('DOMContentLoaded', function() {
  Zoom.setup({
    // Custom options here
  });
});

Competitor Comparisons

JavaScript image gallery for mobile and desktop, modular, framework independent

Pros of PhotoSwipe

  • More feature-rich, offering a full-screen gallery view, touch gestures, and sharing options
  • Responsive design that works well on mobile devices
  • Extensive documentation and customization options

Cons of PhotoSwipe

  • Larger file size and more complex implementation compared to Zoom
  • Steeper learning curve for basic image zooming functionality
  • May be overkill for simple image zoom requirements

Code Comparison

PhotoSwipe (basic implementation):

var pswpElement = document.querySelectorAll('.pswp')[0];
var items = [
    { src: 'image.jpg', w: 1024, h: 768 }
];
var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
gallery.init();

Zoom (basic implementation):

$('img').zoom();

PhotoSwipe offers a more comprehensive solution for image galleries and zooming, while Zoom provides a simpler, lightweight option for basic image zoom functionality. PhotoSwipe is better suited for complex gallery needs, whereas Zoom is ideal for quick implementation of image zooming without additional features.

:zap: Simple and easy to use lightbox script written in pure JavaScript

Pros of baguetteBox.js

  • Lightweight and dependency-free, making it easier to integrate into projects
  • Supports touch gestures for mobile devices, enhancing user experience
  • Offers customizable animations and transitions

Cons of baguetteBox.js

  • Limited to image galleries, while Zoom supports various content types
  • Fewer customization options compared to Zoom's extensive API
  • May require additional setup for advanced features

Code Comparison

baguetteBox.js:

baguetteBox.run('.gallery', {
    animation: 'fadeIn',
    noScrollbars: true,
    buttons: false
});

Zoom:

$('.gallery').zoom({
    url: 'large-image.jpg',
    magnify: 2,
    onZoomIn: function() {
        console.log('Zoomed in');
    }
});

Both libraries offer simple initialization, but Zoom provides more granular control over the zooming behavior and callbacks. baguetteBox.js focuses on gallery functionality with options for animations and UI elements, while Zoom emphasizes image magnification with customizable zoom levels and event handling.

A touchable jQuery lightbox

Pros of Swipebox

  • Supports touch gestures for mobile devices
  • Includes a gallery view for multiple images
  • Offers more customization options through CSS

Cons of Swipebox

  • Larger file size and more complex codebase
  • Requires jQuery dependency
  • May have slower performance on older devices

Code Comparison

Zoom:

$('.zoom').zoom({
  on: 'click',
  magnify: 1.5
});

Swipebox:

$('.swipebox').swipebox({
  useCSS: true,
  hideBarsDelay: 0
});

Key Differences

Zoom focuses on simple image zooming functionality, while Swipebox provides a full-featured lightbox solution with gallery support. Zoom is lightweight and doesn't require jQuery, making it ideal for projects that prioritize performance and minimal dependencies. Swipebox offers more features and customization options but comes with a larger footprint and jQuery requirement.

Use Cases

Choose Zoom for:

  • Basic image zooming needs
  • Projects with performance constraints
  • Lightweight implementations

Choose Swipebox for:

  • Image galleries with touch support
  • Feature-rich lightbox experiences
  • Projects already using jQuery

Both libraries serve different purposes, so the choice depends on specific project requirements and constraints.

Full featured JavaScript image & video gallery. No dependencies

Pros of lightgallery.js

  • More feature-rich, offering a full-fledged gallery experience
  • Supports various media types (images, videos, iframes)
  • Highly customizable with numerous options and plugins

Cons of lightgallery.js

  • Larger file size and potentially heavier on resources
  • Steeper learning curve due to more complex API
  • May be overkill for simple image zoom functionality

Code Comparison

zoom:

$('.zoom').zoom({
  on: 'click',
  magnify: 1.5
});

lightgallery.js:

$('#lightgallery').lightGallery({
  zoom: true,
  scale: 1.5,
  mode: 'lg-fade'
});

Summary

While zoom focuses solely on image zooming with a simple API, lightgallery.js provides a comprehensive gallery solution with advanced features. zoom is lightweight and easy to implement for basic zoom functionality, whereas lightgallery.js offers more customization options and support for various media types at the cost of increased complexity and file size. The choice between the two depends on the specific requirements of the project, with zoom being suitable for simple image zooming needs and lightgallery.js for more advanced gallery implementations.

THE original Lightbox script (v2).

Pros of Lightbox2

  • More feature-rich with support for image sets, captions, and keyboard navigation
  • Highly customizable with extensive options and API
  • Larger community and more frequent updates

Cons of Lightbox2

  • Larger file size and potentially heavier performance impact
  • More complex setup and configuration required
  • May be overkill for simple image zooming needs

Code Comparison

Lightbox2 initialization:

lightbox.option({
  'resizeDuration': 200,
  'wrapAround': true
});

Zoom initialization:

$('img').zoom({
  on: 'grab',
  magnify: 1.5
});

Summary

Lightbox2 is a more comprehensive solution for image galleries and lightboxes, offering a wide range of features and customization options. It's ideal for projects requiring advanced functionality and a polished user experience.

Zoom, on the other hand, is a lightweight and straightforward plugin focused solely on image zooming. It's perfect for simple implementations where only zooming functionality is needed, without the overhead of additional features.

Choose Lightbox2 for feature-rich gallery experiences, and Zoom for quick and easy image zooming functionality.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

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

NPM DownloadsLast 30 Days