This will explain better what I want than my words: http://jquery-image-map.ssdtutorials.com/ Even though the tutorial is available but it is done using image overlays in photoshop. But I am highlighting my mapped image using a jquery plugin "jquery.maphilight.js". Using that I have a mapped Image and it highlights over the mapped portion if I mouse hover on image. How can I display a small picture and paragraph if a person hovers his mouse on a specific room (mapped portion).
Here is the javascript:
$(function () {
$(".mapping").maphilight();
$("#mapping").css('visibility','hidden')
$(".hoverable").css("border", "3px solid red");
& This is the html of image mapping:
<div class="mapping">
<map name="gmap">
<area shape="poly" id="cr1" coords="550,277,485,342,533,385,597,322" href="#" alt="cr1" name="room-1">
<area shape="poly" id="cr2"coords="579,246,627,200,672,246,624,290" href="#" alt="cr2" name="room-2">
Use the jQuery mouseover event.
You would attach it to the 'area' tags on document ready.
$(document).ready(function(){
//this selector is selecting an element by the id of cr1.
$('#cr1').on('mouseover', function(){
//do your showing here
});
$('#cr1').on('mouseleave', function(){
//do your hiding here
});
});
for a generic handler you could do:
$(document).ready(function(){
//this is an attribute selector.
//'area' is the typ of tag to match
//[name indicates the attribute is named 'name'
//^= indicates the attribute 'name' should start with the value following this operator
//'room'] think of this as indicating the value of the name attribute
// should match: 'room*'
$('area[name^="room"]').on('mouseover', function(){
//do your showing here, be sure to show only
//for the appropriate area. Maybe select on the id.
});
$('area[name^="room"]').on('mouseleave', function(){
//do your hiding here. This could be generic unless you have
//a multi-paragrah area instead of a single display area.
});
});