-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUSMAP_init.js
42 lines (39 loc) · 1.15 KB
/
USMAP_init.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
$(function() {
// init the state picker (jvectormap)
var click_map = $('#mapdiv').vectorMap({
map: 'map',
backgroundColor: '#fff',
zoomOnScroll: false,
zoomButtons: false,
regionsSelectable: true,
regionStyle: {
initial: {
fill: 'transparent',
},
hover: {
fill: 'red',
"fill-opacity": .1
},
selected: {
fill: 'red',
"fill-opacity": .3
}
},
onRegionLabelShow: function(e, label, code) { //hide the tooltip
e.preventDefault();
},
onRegionSelected: function(event, code, isSelected) {
if (isSelected == true) {
$("#" + code).prop("selected", "selected")
} else {
$("#" + code).prop("selected", false)
}
}
});
//clear map and selected options
$('#clearbtn').click(function(event) {
var mapObject = $('#mapdiv').vectorMap('get', 'mapObject');
mapObject.clearSelectedRegions();
$('#State').val('');
})
});