Open brianrc opened 11 years ago
Your option and binding code isn't working correctly because you aren't specifying an event. There's mouseover, mouseout, and click.
This should fix your option code:
$('#map').usmap({
clickState: {
'MD': function(event, data) {
console.log('You interacted with the state of Maryland');
}
}
});
As far as I can tell, your binding code should look like the code below. I tried working it into some of my existing map code and it didn't work, so watch out I guess.
$('#map').on('usmapclickMD', function(event, data) {
console.log('You clicked on the state of Maryland');
});
Sorry, even inputting both code examples above into the demo file I still cannot get it to work.
One thing to note is the example file includes jquery 1.6.2 and .on() (in example 2) isn't supported until jquery 1.7. However, even updating to jquery 1.8.2, the code still does not work! :(
Yes, I know how to access the console and I even tried replacing it with $('#somediv').html('text here'); but there is no affect when MD is clicked. Tested in latest Chrome and Firefox.
Can you send me a gist that works?
Thanks for your help.
Are there any other example implementations of this map out there on the web?
I really need to get this working. I'm on a deadline.
Thanks!!
I found another map that I think is going to be a better fit for me, so this is no longer critical, but thank you all!
What map did you find? I cannot get this to work either.
http://jqvmap.com/ works
Hi,
Thank you for the link. I've been trying to add in some code but I am getting errors. I want to add the onClick function but it is not letting me. Any suggestions?
Never mind, I got it to function correctly. Thank you all for the help!
Hello, I'm having trouble getting events to work at all. Is below supposed to be replaced with something? It's not clear from the directions. Leaving it in gives a syntax error.
As an option:
$('#map').usmap({