forked from NewSignature/us-map
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
86 lines (74 loc) · 1.98 KB
/
index.html
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html>
<head>
<title>US Map Demo</title>
<style>
#alert {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
background-color: #ddd;
color: #333;
padding: 5px;
font-weight: bold;
}
</style>
<script src="/lib/raphael.js"></script>
<!-- <script src="scale.raphael.js"></script> -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"></script>
<script src="/color.jquery.js"></script>
<script src="/us-map.js"></script>
<script>
$(document).ready(function() {
$('#map').usmap({
'stateSpecificStyles': {
'AK' : {fill: '#f00'}
},
'stateSpecificHoverStyles': {
'HI' : {fill: '#ff0'}
},
'mouseoverState': {
'HI' : function(event, data) {
//return false;
}
},
'click' : function(event, data) {
$('#alert')
.text('Click '+data.name+' on map 1')
.stop()
.css('backgroundColor', '#ff0')
.animate({backgroundColor: '#ddd'}, 1000);
}
});
$('#map2').usmap({
'stateStyles': {
fill: '#025',
"stroke-width": 1,
'stroke' : '#036'
},
'stateHoverStyles': {
fill: 'teal'
},
'click' : function(event, data) {
$('#alert')
.text('Click '+data.name+' on map 2')
.stop()
.css('backgroundColor', '#af0')
.animate({backgroundColor: '#ddd'}, 1000);
}
});
$('#over-md').click(function(event){
$('#map').usmap('trigger', 'MD', 'mouseover', event);
});
$('#out-md').click(function(event){
$('#map').usmap('trigger', 'MD', 'mouseout', event);
});
});
</script>
</head>
<body>
<div id="alert">Click alerts</div>
<div id="map" style="width: 930px; height: 630px; border: solid 3px red;"></div>
<button id="over-md">mouseover MD</button> <button id="out-md">mouseout MD</button>
<div id="map2" style="width: 300px; height: 300px;"></div>
</body>
</html>