JSFiddle - React, Tailwind, and code Playground
HTML
<div class="wiz-content" id="question1">
<h2>Step 1: Select your body shape</h2>
<div class="map-container-2">
<img id="thin" src="http://i.imgur.com/U3MaB.png" rel="1" />
<img id="muscles" src="http://i.imgur.com/ThYBn.png" rel="2" />
<img id="rotund" src="http://i.imgur.com/1i1nw.png" rel="3" />
<img id="blank2" src="http://web-scholar.com/stackoverflow/images/blank.gif" usemap="#shape" />
</div>
<map name="shape" id="shape">
<area shape="poly" coords="84,17,77,39,83,58,84,69,74,71,69,129,71,168,77,183,86,187,91,265,83,279,105,285,127,283,119,262,120,212,120,180,132,173,129,112,120,67,109,59,112,37,108,23,99,14" href="#" alt="thin" />
<area shape="poly" coords="292,21,289,38,280,46,289,61,256,75,253,107,257,129,251,149,256,170,262,198,271,195,280,187,286,212,284,235,292,272,281,284,309,286,344,282,336,267,344,245,339,212,347,176,344,146,348,182,358,190,373,194,376,173,374,141,365,102,362,73,329,60,329,42,319,25,305,19" href="#" alt="muscles" />
<area shape="poly" coords="535,19,530,26,519,58,505,79,488,102,485,125,483,167,493,202,504,216,519,275,521,283,562,287,583,216,605,161,597,101,575,76,568,57,570,45,554,22,545,19" href="#" alt="rotund" />
</map>
</div>
CSS
.map-container-1 {
position:relative;
width:671px;
height:440px;
z-index:1000;
}
.map-container-2 {
position:relative;
width:671px;
height:300px;
}
.map-container-3 {
position:relative;
width:671px;
height:372px;
}
#blank1 {
width:671px;
height:440px;
}
#blank2 {
width:671px;
height:300px;
}
#blank3 {
width:671px;
height:372px;
}
#mainNav.fiveStep li,#mainNav.fiveStep li a {
width:182px;
}
#mainNav.fourStep li,#mainNav.fourStep li a {
width:227px;
}
#mainNav.threeStep li,#mainNav.threeStep li a {
width:303px;
}
#mainNav.twoStep li,#mainNav.twoStep li a {
width:455px;
}
.map-container-1 img,.map-container-2 img,.map-container-3 img,.map-container-4 img,.map-container-5 img {
position:absolute;
top:0;
left:0;
opacity:0.4;
}
.map-container-1 img.hover,.map-container-2 img.hover,.map-container-3 img.hover,.map-container-4 img.hover,.map-container-5 img.hover {
opacity:0.5;
}
.map-container-1 img.selected-region,.map-container-2 img.selected-region,.map-container-3 img.selected-region,.map-container-4 img.selected-region,.map-container-5 img.selected-region {
opacity:1;
}
.map-container-4,.map-container-5 {
position:relative;
border:1px solid red;
width:671px;
height:440px;
}
JavaScript
$(window).load(function(){
//Get cookies when page loaded
var useranswers=$.cookie('survery');
useranswers= JSON.parse (useranswers);
// do something with previous answers
//#shape functions
$('#shape area').hover(
function(e){
$('#'+ this.alt).addClass('hover');
},
function(e){
$('#'+ this.alt).removeClass('hover');
}
);
$('#shape area').click(
function(e){
$('img.selected-region').removeClass('selected-region');
},
function(e){
$('#'+ this.alt).addClass('selected-region');
},
function(e){
var answer = $(this).attr("class");
}
// jQuery.extend merges contents of two or
// more objects together into the first object
//$.extend(useranswers,{
//answer1 : $("img.selected-region").attr('rel')
//});
//$.cookie('survery',
//JSON.stringify(useranswers),
//{ expires: 7, path: '/', domain: '<your_domain_name>' }
//);
);
});