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

responsive-image-map

v1.0.6

Published

Responsive map according to image size

Downloads

52

Readme

responsive-image-map

npm license downloads

responsive-image-map make map to responsive map according to image size

Installation

# Node Package Manager
npm install responsive-image-map

# CDN
# Opting unpkg or jsdelivr
<script src="https://unpkg.com/responsive-image-map/dist/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/responsive-image-map/dist/index.min.js"></script>

Usage

JavaScript

// case1
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="dist/index.js"></script>
  </head>
  <body>
    <img
      src="https://github.com/user-attachments/assets/6cf473f8-5004-4972-884b-d5436fece34b"
      usemap="#image-map-1"
      class="class1"
      style="width: 100%; height: 100%"
    />
    <map name="image-map-1">
      <area
        shape="rect"
        coords="100,100,200,200"
        href="https://github.com/geongupark/responsive-image-map/issues/new"
        alt="Example 1"
      />
    </map>
    <script>
      document.addEventListener("DOMContentLoaded", function () {
        ResponsiveImageMap.makeResponsiveImageMap("class1"); // Add your class names here
      });
    </script>
  </body>
</html>

// case2
import { makeResponsiveImageMap } from "responsive-image-map";

document.addEventListener("DOMContentLoaded", function () {
  ResponsiveImageMap.makeResponsiveImageMap("class1", "class2"); // Add your class names here
});

React

import React, { useEffect } from "react";
import { makeResponsiveImageMap } from "responsive-image-map";

const App = () => {
  useEffect(() => {
    makeResponsiveImageMap("class1", "class2"); // Add your class names here
  }, []);

  return (
    <>
      <img src="image1.jpg" useMap="#image-map-1" className="class1" />
      <map name="image-map-1">
        <area
          shape="rect"
          coords="50,50,150,150"
          href="https://example.com"
          alt="Example"
        />
      </map>
    </>
  );
};

export default App;

Vue

<template>
  <div>
    <img src="image1.jpg" useMap="#image-map-1" class="class1" />
    <map name="image-map-1">
      <area shape="rect" coords="50,50,150,150" href="https://example.com" alt="Example" />
    </map>
  </div>
</template>

<script setup>
import { onMounted } from 'vue';
import { makeResponsiveImageMap } from 'responsive-image-map';

onMounted(() => {
  makeResponsiveImageMap('class1', 'class2'); // Add your class names here
});
</script>

Contributing

We welcome contributions!

License

This project is licensed under the MIT License