Skip to content
This repository was archived by the owner on Mar 24, 2020. It is now read-only.

Added U.S. Territories, hover states for text labels, iPad/iPhone support #34

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

<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="jquery-3.5.1.min.js"></script>
<script src="color.jquery.js"></script>
<script src="../us-map.js"></script>
<script src="../jquery.usmap.min.js"></script>

<script>
$(document).ready(function() {
Expand All @@ -29,6 +29,9 @@
'stateSpecificHoverStyles': {
'HI' : {fill: '#ff0'}
},
'stateSpecificLabelTextStyles': {
'HI' : { fill: '#333333' }
},

'mouseoverState': {
'HI' : function(event, data) {
Expand All @@ -42,7 +45,7 @@
.text('Click '+data.name+' on map 1')
.stop()
.css('backgroundColor', '#ff0')
.animate({backgroundColor: '#ddd'}, 1000);
.animate({backgroundColor: '#ddd'}, 500);
}
});

Expand All @@ -52,6 +55,9 @@
"stroke-width": 1,
'stroke' : '#036'
},
'stateSpecificLabelTextStyles': {
'HI' : { fill: '#025' }
},
'stateHoverStyles': {
fill: 'teal'
},
Expand All @@ -61,7 +67,7 @@
.text('Click '+data.name+' on map 2')
.stop()
.css('backgroundColor', '#af0')
.animate({backgroundColor: '#ddd'}, 1000);
.animate({backgroundColor: '#ddd'}, 500);
}
});

Expand All @@ -72,6 +78,34 @@
$('#out-md').click(function(event){
$('#map').usmap('trigger', 'MD', 'mouseout', event);
});

$('#us-map-terr').usmap({
'stateStyles': {
fill: '#eef3fc',
stroke: '#336699'
},
'stateHoverAnimation': false,
'stateHoverStyles': {
fill: '#336699',
stroke: '#336699'
},
'labelBackingStyles': {
fill: '#eef3fc',
stroke: '#336699'
},
'labelTextStyles': {
fill: '#336699'
},
'labelTextHoverStyles': {
fill: '#ffffff'
},
'labelBackingHoverStyles': {
fill: '#336699'
},
'includeTerritories': [ 'PR', 'VI' ],
'click' : function(event, data) {
}
});
});
</script>
</head>
Expand All @@ -82,5 +116,8 @@

<button id="over-md">mouseover MD</button> <button id="out-md">mouseout MD</button>
<div id="map2" style="width: 300px; height: 300px;"></div>

<h3>Map including Puerto Rico and U.S. Virgin Islands</h3>
<div id="us-map-terr" style="width: 700px; height: 500px;"></div>
</body>
</html>
2 changes: 2 additions & 0 deletions example/jquery-3.5.1.min.js

Large diffs are not rendered by default.

Loading