views:

46

answers:

2

I have run into a problem that i cannot seem to figure out how to do and was hoping that you might have some insight.

im working on this page: http://rrpcompliance.com/map/html/

note: right now the only states i am focusing on are washington and idaho i would like the user to only be able to select one state at a time currently for instance, you can select washington and idaho both

for the life of me i cannot figure out how to tell the maphilight script to deactivate the other state after a new one has been clicked

A: 
var clicked = '';
var last_clicked = '';

$(function() {
    //class="map"
    $('.map').maphilight({fade: false}); /*set true for fading hover effect*/
    $('map > area').easyTooltip(); /*use for html code version*/
    $('#usa area').click(function(){
        last_clicked = clicked;
        clicked = $(this).attr('id');
        mouseclick(null,document.getElementById(last_clicked));
    });

});

add this to your script tag in the head

wowo_999
Can you accept my answer plz?
wowo_999
A: 

thank-you very much for your help! I tweaked your suggestion slightly and its working like a charm:

  $('#usa area').click(function(){
     clicked = $(this).attr('id');
     if (last_clicked != '') {
     mouseclick(null,document.getElementById(last_clicked));
     }
     last_clicked = clicked;
  });
Matthew Reed