jQuery maphilight documentation

maphilight applies to images with a 'usemap' attribute, and outlines the areas defined in their map on mouseover.

It provides a single jQuery function: $.maphilight

This would hilight every image with a map on the page: $('img[usemap]').maphilight()

Demos

The simple demo (with awful art, and examples of the metadata plugin)

A map of the world

A map of the USA

Plugin methods

maphilight( [options] ): returns jQuery
Add hilight behavior to an imagemap
$.maphilight.defaults
Default settings for all maphilight calls

maphilight( [options] )

The method that adds hilight behavior to an imagemap.

Arguments:

options (optional)

A set of key/value pairs that configures the map. All options are optional.

The metadata plugin is supported, and all options can be overriden per-img, or per-area.

Example: to make one particular hilight green:

<area ... class="{fillColor:'00ff00'}">

Options:

fill (Boolean. Default: true)
Whether to fill the shape
fillColor (String. Default: '000000')
The color to fill the shape with
fillOpacity (Number. Default: 0.2)
The opacity of the fill (0 = fully transparent, 1 = fully opaque)
stroke (Boolean. Default: true)
Whether to outline the shape
strokeColor (String. Default: 'ff0000')
The color of the outline
strokeOpacity (Number. Default: 1)
The opacity of the outline (0 = fully transparent, 1 = fully opaque)
strokeWidth (Number. Default: 1)
The thickness of the outline
fade (Boolean. Default: true)
Whether to fade in the shapes on mouseover
alwaysOn (Boolean. Default: false)
Whether to always show the hilighted areas
(note that this currently has no effect if supplied as metadata on the area itself)

$.maphilight.defaults

The defaults for all uses of maphilight can be set here. If you manually replace this, you have to specify all options.

$.fn.maphilight.defaults = {
	fill: true,
	fillColor: '000000',
	fillOpacity: 0.2,
	stroke: true,
	strokeColor: 'ff0000',
	strokeOpacity: 1,
	strokeWidth: 1,
	fade: true,
	alwaysOn: false
}

Changelog

Tested with