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

js-img-magnify

v0.0.8

Published

Pure JavaScript utility enabling magnifying glass effect on an images

Downloads

7

Readme

js-img-magnify

npm npm bundle size npm

Pure JavaScript utility enabling magnifying glass effect on an images. No external dependencies required.

So you can use it in any web application, such as Vue, React,Angular, Svelte, or any other application.

support Typescript

Demo

view Demo

How to use

  • npm or yarn

    • install
      npm i js-img-magnify
      # or
      yarn js-img-magnify
    • use
      import magnifyImg from 'js-img-magnify';
      import img from './assets/waterDrop.jpg';
      magnifyImg({
          src: img,   // or img url
          zoom: 3,
          target: document.getElementById('example'),
          width: 500, // img width, Can also '50%'
          MagnifyDomStyles: {"borderRadius":"50%","border":"4px solid red"},
          MagnifyDom: document.getElementById('show'),
          ...
      })
  • cdn

    • install
      <script src="https://cdn.jsdelivr.net/npm/js-img-magnify@latest/lib/js-img-magnify.umd.js"></script>
    • use
      magnifyImg({
          src: imgURL,
          zoom: 3,
          target: document.getElementById('example'),
          width: 500, // img width, Can also '50%'
          MagnifyDom: document.getElementById('show'),
          ...
      })

Props

| propName | type | required |desc | default | | --- | --- | --- |--- |--- | | src | string | true | img tag src prop | | | zoom | number | false| magnification times | 3 | |target | HTMLElement| true | target HTMLElement || |width | string/number | false | imgTag width,100 or "50%" | "auto" | |MagnifyDomWidth| number| false| js created magnifying glass dom, if MagnifyDom has value, This will not work. | 200| |MagnifyDomStyles|partialCSSStyleDeclaration|false|it will merge js created magnifying glass dom styles, if MagnifyDom has value, This will not work | {} | |MagnifyDom| HTMLElement| false | user custom magnify Dom | |overflow | Boolean | false | Whether or not to allow exceeding the image range at the image edges | true |