Giter Site home page Giter Site logo

rahul2224 / image-map Goto Github PK

View Code? Open in Web Editor NEW

This project forked from clarketm/image-map

0.0 0.0 0.0 171 KB

Responsive, dynamic image maps.

Home Page: https://blog.travismclarke.com/project/imagemap/

License: Apache License 2.0

JavaScript 59.71% HTML 34.86% Shell 5.43%

image-map's Introduction

NPM release Build Status

image-map

A native JavaScript solution for creating responsive image-maps that rerender on image or viewport changes.

Check out the demo!

Installation

Install with npm

$ npm install image-map

Install with bower

$ bower install image-map

CDN

Module (.es.js) Main (.js) Main (compressed) .min.js
๐Ÿ”— ๐Ÿ”— ๐Ÿ”—

Generating the image map html

You can generate image maps using this wonderful online tool: https://www.image-map.net/. It works for both local and web images.

Usage

Add an image-map to your html page (either create one yourself or try the online image map generator).

An image-map is an image with clickable areas. The required name attribute of the <map> element is associated with the <img>'s usemap attribute and creates a relationship between the image and the map. The <map> element contains a number of <area> elements, that defines the clickable areas in the image map.

<img usemap="#image-map" src="/path/to/image">

<map name="image-map">
      <area shape="poly" coords="22,22,231,22,264,82,232,143,22,143">
      <area shape="poly" coords="233,22,443,22,476,82,442,144,233,143,264,82">
      <area shape="poly" coords="445,22,654,22,686,81,654,143,444,143,475,82">
      <area shape="poly" coords="655,22,895,22,895,142,655,142,684,82">
</map>

jQuery

To use this plugin with jQuery, include (or import) both the jQuery and image-map.js libraries, then simply call:

$('img[usemap]').imageMap();

The default debounce rate is 500ms. To customize this value, pass a numeric wait value as the first argument.

$('img[usemap]').imageMap(500);

JavaScript (Vanilla JS)

To use this plugin with only JavaScript, include (or import) the image-map.js library, then simply call:

ImageMap('img[usemap]')

The default debounce rate is 500ms. To customize this value, pass a numeric wait value as the second argument.

ImageMap('img[usemap]', 500)

image-map's People

Contributors

clarketm avatar stowball avatar mathiasbynens avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.