Vector Map

In this example below you will see how to do a Vector Map with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by craigwheeler, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright craigwheeler ©
  • HTML
  • CSS
  • JavaScript
    <div id="container">
	<div id="vmap" style=""></div>
</div>

/*Downloaded from https://www.codeseek.co/craigwheeler/vector-map-qaKboL */
    body {
	background-color: #222;
}
#container {
	position: absolute;
	top: 50%;
	margin-top: -200px;
	left: 0;
	width: 100%;
}
#vmap {
	width: 100%;
	height: 300px;
	margin-left: auto;
	margin-right: auto;
	height: 395px;
}


/*Downloaded from https://www.codeseek.co/craigwheeler/vector-map-qaKboL */
    $(document).ready(function() {
    jQuery('#vmap').vectorMap({
        map: 'world_en',
        backgroundColor: null,
        color: '#057',
        hoverOpacity: 0.7,
        selectedColor: '#666666',
        enableZoom: true,
        showTooltip: true,
        scaleColors: ['#C8EEFF', '#006491'],
        values: sample_data,
        normalizeFunction: 'polynomial',
        onRegionClick: function (event, code, region) {
            alert('You clicked on ' + region);
        }
    });
});

Comments