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

Added LabelTextHoverStyles support + Extras #13

Open
wants to merge 1 commit 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
160 changes: 85 additions & 75 deletions example/index.html
Original file line number Diff line number Diff line change
@@ -1,85 +1,95 @@
<!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>
<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="../jquery.usmap.js"></script>

<script>
$(document).ready(function() {
$('#map').usmap({

// Testing Text Hover Styles
labelTextHoverStyles: {
fill: '#F00'
},
stateSpecificLabelTextHoverStyles: {
'MD': { fill: 'orange' }
},

// Testing State Specific Styles
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>
Expand Down
Loading