npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

modernized-easyzoom

v1.0.0

Published

This project is a modernized version of the original EasyZoom, rewritten in pure JavaScript without jQuery dependencies.

Downloads

9

Readme

Modernized EasyZoom

Modernized EasyZoom is a lightweight, easy-to-use JavaScript library for implementing image zoom functionality on web pages. This project is a modernized version of the original EasyZoom, rewritten in pure JavaScript without jQuery dependencies. It provides a smooth and responsive zoom effect for product images, making it ideal for e-commerce websites and online galleries.

Features

  • Responsive image zooming
  • Thumbnail support for multiple images
  • Lazy loading of zoom images for improved performance
  • Smooth animations and transitions
  • Customizable options
  • No jQuery dependency - pure JavaScript

Installation

You can include Modernized EasyZoom in your project using one of the following methods:

1. Direct download

Download the modernized-easyzoom.js and modernized-easyzoom.css files from this repository and include them in your HTML:

<link rel="stylesheet" href="path/to/modernized-easyzoom.css">
<script type="module" src="path/to/modernized-easyzoom.js"></script>

2. npm

npm install modernized-easyzoom

Then import it in your JavaScript:

import EasyZoom from 'modernized-easyzoom';

Usage

Here's a basic example of how to use Modernized EasyZoom:

<div class="easyzoom easyzoom--overlay">
    <a href="https://source.unsplash.com/1600x900/?nature">
        <img src="https://source.unsplash.com/400x300/?nature" alt="Nature" />
    </a>
</div>

<script type="module">
    import EasyZoom from './path/to/modernized-easyzoom.js';

    document.addEventListener('DOMContentLoaded', () => {
        const easyZoomElement = document.querySelector('.easyzoom');
        const easyZoom = new EasyZoom(easyZoomElement);
    });
</script>

Examples

Basic Zoom

Here's a simple example using a nature image from Unsplash:

<div class="easyzoom easyzoom--overlay">
    <a href="https://source.unsplash.com/1600x900/?nature">
        <img src="https://source.unsplash.com/400x300/?nature" alt="Nature" />
    </a>
</div>

With Thumbnails

Here's an example using multiple product images with thumbnails:

<div class="easyzoom easyzoom--overlay easyzoom--with-thumbnails">
    <a href="https://source.unsplash.com/1600x900/?product">
        <img src="https://source.unsplash.com/400x300/?product" alt="Product" />
    </a>
</div>

<div class="thumbnails">
    <a href="https://source.unsplash.com/1600x900/?product" data-standard="https://source.unsplash.com/400x300/?product">
        <img src="https://source.unsplash.com/60x60/?product" alt="Product Thumbnail" />
    </a>
    <a href="https://source.unsplash.com/1600x900/?product,angle" data-standard="https://source.unsplash.com/400x300/?product,angle">
        <img src="https://source.unsplash.com/60x60/?product,angle" alt="Product Angle Thumbnail" />
    </a>
    <a href="https://source.unsplash.com/1600x900/?product,detail" data-standard="https://source.unsplash.com/400x300/?product,detail">
        <img src="https://source.unsplash.com/60x60/?product,detail" alt="Product Detail Thumbnail" />
    </a>
</div>

<script type="module">
    import EasyZoom from './path/to/modernized-easyzoom.js';

    document.addEventListener('DOMContentLoaded', () => {
        const easyZoomElement = document.querySelector('.easyzoom--with-thumbnails');
        const easyZoom = new EasyZoom(easyZoomElement);

        const thumbnails = document.querySelector('.thumbnails');
        if (thumbnails) {
            thumbnails.addEventListener('click', (e) => {
                e.preventDefault();
                const target = e.target.closest('a');
                if (target) {
                    easyZoom.swap(target.getAttribute('data-standard'), target.getAttribute('href'));
                }
            });
        }
    });
</script>

Options

You can customize Modernized EasyZoom by passing an options object when initializing:

const easyZoom = new EasyZoom(element, {
    loadingNotice: 'Loading image',
    errorNotice: 'The image could not be loaded',
    errorDuration: 2500,
    linkAttribute: 'href',
    preventClicks: true,
    onShow: () => console.log('Zoom shown'),
    onHide: () => console.log('Zoom hidden'),
    onMove: (x, y) => console.log('Zoom moved', x, y)
});

Browser Support

Modernized EasyZoom works in all modern browsers that support ES6+ JavaScript.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Acknowledgements