JSFiddle - React, Tailwind, and code Playground
qtip with jqvmap
HTML
<script src="http://jqvmap.com/js/vmap/jquery.vmap.js?v=1.0"></script>
<script src="http://jqvmap.com/js/vmap/jquery.vmap.sampledata.js?v=1.0"></script>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/qtip2/2.2.0/jquery.qtip.min.css">
<script src="http://cdn.jsdelivr.net/qtip2/2.2.0/jquery.qtip.js"></script>
<script src="https://cdn.rawgit.com/brasofilo/8113470a8efef43968d4/raw/0b44a75c308f905b19667df9e712de09ff9c9ca1/jquery.vmap.world.js"></script>
<div id="vmap"></div>
CSS
.fiddle-header {
background-color: #ccc;
margin:0 0 10px 0;
text-align: center;
color: #fff;
font-family: sans-serif;
}
.fiddle-header a {
text-decoration: none;
color: #eee
}
/*!
* jQVMap Version 1.0
*
* http://jqvmap.com
*
* Copyright 2012, Peter Schmalfeldt <[email protected]>
* Licensed under the MIT license.
*
* Fork Me @ https://github.com/manifestinteractive/jqvmap
*/
#vmap {
width: 600px;
height: 400px;
}
.jqvmap-label {
position: absolute;
display: none;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
background: #292929;
color: white;
font-family: sans-serif, Verdana;
font-size: smaller;
padding: 3px;
}
.jqvmap-zoomin, .jqvmap-zoomout {
position: absolute;
left: 10px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
background: #000000;
padding: 3px;
color: white;
width: 10px;
height: 10px;
cursor: pointer;
line-height: 10px;
text-align: center;
}
.jqvmap-zoomin {
top: 10px;
}
.jqvmap-zoomout {
top: 30px;
}
.jqvmap-region {
cursor: pointer;
}
.jqvmap-ajax_response {
width: 100%;
height: 500px;
}
JavaScript
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
}
}
})