Reputation: 41
I want to set regions in the map without data to be disabled from clicking. Is there any way to do that...I have been successful with disabling color change onRegionOver, but the same regions still responds to click (and changes color of region...). I tried calling preventDefault() method from onRegionOver and onRegionClick events...But it did not help... Would appreciate any help.
Thank you!
Upvotes: 4
Views: 2715
Reputation: 1516
Late response, but maybe this can help the next person.
var states = 'ca,co,tx,ny,ks,mo';
$('#vmap').vectorMap({
map: 'usa_en',
selectedRegion: 'tx',
backgroundColor: '#ffffff',
color: '#E6E7E9',
hoverColor: '#03235E',
enableZoom: false,
showTooltip: true,
onRegionOver: function (event, code, region) {
// if it's not in the approved list, do nothing,
// else allow normal behavior
if (states.toLowerCase().indexOf(code) <= -1) {
event.preventDefault();
}
},
onRegionClick: function (event, code, region) {
// if it's not in the approved list, do nothing, else handle it
if (states.toLowerCase().indexOf(code) <= -1) {
event.preventDefault();
}
else {
//handle state click
}
}
})
Upvotes: 3