0

I have 2 images bound with imagemapster. When I click an area it stays selected, which is fine. I need to change the behaviour so that when I click an area I want the other areas to deselect.

Is that possible?

<img onClick="pruebaImagemapster();" src="images/desplegable_pag04_2.png" alt="Desplegable" width="358" height="213" border="0" usemap="#Map2" class="map" />
<map name="Map2"><area shape="rect" coords="198,70,310,146" onclick="clickAbrirSubmenu('links5')" href="javascript:;">
    <area shape="rect" coords="49,70,163,145" onclick="clickAbrirSubmenu('links4')" href="javascript:;">
</map>

<img onClick="pruebaImagemapster();" src="images/desplegable_pag04.png" alt="Desplegable" width="694" height="104" border="0" usemap="#Map" class="map" />
<map name="Map">
    <area shape="rect" coords="377,7,693,96" onclick="clickAbrirSubmenu('links3')" href="javascript:;">
    <area shape="rect" coords="3,6,317,92" onclick="clickAbrirSubmenu('links2')" href="javascript:;">
</map>

Feel free to ask me for more information if you don't understand what I am trying to achieve.

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
AngelQuesada
  • 387
  • 4
  • 19

2 Answers2

0

I did it!

All my areas have their own id so when I click one I force the others to "deselect". Here is my script:

    var nAreas = $('area').length;
    //alert(nAreas);
    for(var i=0;i<=nAreas;i++){
        if(idArea == 'area'+i){
            /*Nada*/
        }else{
          $('#area'+i).mapster('deselect');  
        } 
    }
AngelQuesada
  • 387
  • 4
  • 19
0

Its late but may be help full for others. If you want to select only one area at a time you can use builtin functionality.

Use

singleSelect: false

in options at time of plugin initialization.

Danesh
  • 46
  • 5