Git Product home page Git Product logo

stunning-imagemaps's Introduction

Stunning ImageMaps

Converts HTML image maps to SVG equivalents.

Background

The initial reason for this plugin was to fix the image maps click problem in iOS8. But under the way I realized the plugin also could fix the responsive problem at the same time.

Installation

The plugin supports ”globals”, AMD and CommonJS. Install with bower install stunning-imagemaps or npm install stunning-imagemaps.

Initialize

Globals

The plugin is available in the window object as window.stunningImageMaps, so it's available to use like this:

stunningImageMaps.toSVG();

jQuery

Get “the real“ element when using in a jQuery environment.

stunningImageMaps.toSVG( $('map#imgmap').get(0) );

Browserify (CommonJS)

var stunningImageMaps = require('stunning-imagemaps');

stunningImageMaps.toSVG();

Options

The options object and their default setting.

.setup({
	inlineStyle: true	 			// Create inline styles or not
	useImageParentAsWrap: false,	// Will create wrap element if false
	classNames: {					// Class names
		prefix: 'imgmap__', 		// Prefix
		wrap: 'wrap',				// Wrap elements
		wrapIndividual: 'wrap--%',	// Individual wrap elements, % will be changed to map name attribute
		svg: 'svg',					// SVG elements
		svgIndividual: 'svg--%'	,	// Individual SVG elements, % will be changed to map name attribute
		area: 'area',				// Area elements
		areaIndividual: 'area--%'	// Individual area elements, % will be changed to map name attribute
	},
	onClick: function(e) { }		// Will be called when clicking area shape
});

Methods

// Change default options
.setup( options );

// Convert specific or all imagemaps to SVG, by giving either the img or map element.
.toSVG( [nothing for all, element or elements for specific] )

stunning-imagemaps's People

Watchers

rosa maria palacios juncosa avatar  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.