maphilight applies to images with a 'usemap' attribute, and outlines the areas defined in their map on mouseover.
It provides a single jQuery function: $('.foo').maphilight()
This would hilight every image with a map on the page: $('img[usemap]').maphilight()
The simple demo (with awful art, and examples of data attributes)
maphilight( [options] )
: returns jQuery$.maphilight.defaults
maphilight( [options] )
The method that adds hilight behavior to an imagemap.
options
(optional)A set of key/value pairs that configures the map. All options are optional.
All options can be overridden with the jQuery data
method, per-img
and per-area
.
The metadata plugin is also supported.
Order of inheritance:
$(area).data('maphilight')
$(area).metadata()
$(img).data('maphilight')
$(img).metadata()
$(img).maphilight(options)
Example: to make one particular hilight green:
<area ... class="{fillColor:'00ff00'}">
$.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,
neverOn: false,
groupBy: false,
wrapClass: true,
shadow: false,
shadowX: 0,
shadowY: 0,
shadowRadius: 6,
shadowColor: '000000',
shadowOpacity: 0.8,
shadowPosition: 'outside',
shadowFrom: false
}
alwaysOn
work per-area with metadata plugin.alwaysOn
option. Fixed behavior in Firefox2/Safari/Opera.