Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dynamic-imagemap

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamic-imagemap

A jQuery plugin to create dynamic image map

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

jquery.dynamic.imagemap

A jQuery plugin to create dynamic elements to be placed over image map area tag by using the coordinates in corresponding area tag. This plugin can be useful when server responds with some coordinates on image and need to create some custom element which will placed on top of image with respect to these coordinates. Here coordinates data are given from server side to area tag "coords" attribute.

Demo

See Demo here.

Installation

npm install dynamic-imagemap

Getting Started

Usage

Javascript

$(document).ready(function() {
	$('#first-image').dynamicImageMap({
        areas: $('#first-map area') /* Area tags inside of image corresponding map tag */
    });

    /* Here image "usemap" attribute is checked to find the area tags */
	$('#second-image').dynamicImageMap();

});

HTML

<img id="first-image" src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap">

<map id="first-map" name="planetmap">
  <area shape="rect" coords="0,0,82,126" data-style="background: red"  alt="Sun" href="sun.htm">
  <area shape="circle" coords="90,58,3" data-class="mercury" data-style="background: yellow" alt="Mercury" href="mercur.htm">
  <area shape="circle" coords="124,58,8" data-class="venus"  data-style="background: green" alt="Venus" href="venus.htm">
</map>
Documentation

The dynamicImageMap method will accept one optional object argument.

Optional object parameter

  • areas : The area tags selector that used for image map.

The area tag can have some data attributes in HTML which is used to pass data to custom created dynamic elements. The following are data attributes

  • data-class : The class names that passed to custom created element.
  • data-style : The styles that passed to custom created element.
  • data-content : The inner html that passed to custom created element.

A wrapper div container is placed automatically created on image on method call. We can pass class and style to container using data attributes in image tag.

  • data-class : The class names that passed to wrapper of image element.
  • data-style : The styles that passed to wrapper of image element.

An example is placed in example folder. Please take map.html in web browser to see what happens with plugin usage.

Notes

The v0.0.1 only supports area tags with shape "circle" and "rect". The "poly" area shape is still not supported.

License

The MIT License (MIT)

Copyright (c) 2015 Justin John Mathews justinjohnmathews@gmail.com

Keywords

FAQs

Package last updated on 23 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc