JSFiddle - React, Tailwind, and code Playground

by neveldo

HTML

<script src="https://cdn.rawgit.com/DmitryBaranovskiy/raphael/v2.1.4/raphael-min.js"></script>
<script src="https://cdn.rawgit.com/neveldo/jQuery-Mapael/1.1.0/js/jquery.mapael.js"></script>
<script src="https://cdn.rawgit.com/neveldo/jQuery-Mapael/1.1.0/js/maps/france_departments.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js"></script>
<div class="container">
	<h1>Use 'zoom' event in order to zoom on specific areas of the map</h1>
           <input type="button" value="Zoom on Paris area" id="gotoparis" />
		   <input type="button" value="Zoom on Lyon area" id="gotolyon" />
		   <input type="button" value="Clear zoom" id="clearzoom" />
		<div class="mapcontainer">
			<div class="map">
				<span>Alternative content for the map</span>
			</div>
		</div>
</div>

CSS

.mapTooltip {
			position : fixed;
			background-color : #fff;
			moz-opacity:0.70;
			opacity: 0.70;
			filter:alpha(opacity=70);
			border-radius:10px;
			padding : 10px;
			z-index: 1000;
			max-width: 200px;
			display:none;
			color:#343434;
		}

		.zoomIn, .zoomOut {
			background-color:#fff;
			border:1px solid #ccc;
			color:#000;
			width:15px;
			height:15px;
			line-height: 15px;
			text-align:center;
			border-radius:3px;
			cursor:pointer;
			position:absolute;
			top : 10px;
			font-weight:bold;
			left : 10px;
			
			-webkit-user-select: none; // For Webkit
			-khtml-user-select: none;
			-moz-user-select: none; // For Mozilla
			-o-user-select: none;
			user-select: none; // Default
		}
		
		.zoomOut {
			top:30px;
		}
		
	    .map {
			position:relative;
		}	

		body {
			font-family:Helvetica,Arial,sans-serif;
		}
	
		h1 {
			color:#5d5d5d;
			font-size:30px;
		}

        .container {
            max-width: 800px;
            margin:auto;
        }

        .mapcontainer {
            margin:10px;
        }

JavaScript

$(function(){
	$maparea2 = $(".mapcontainer");
	$maparea2.mapael({
		map : {
			name : "france_departments"
			, zoom: {
				enabled: true,
				maxLevel : 10
			}
			, defaultPlot : {
				attrs : {
					opacity : 0.6
				}
			}
		},
		plots : {
			'paris' : {
				latitude : 48.86, 
				longitude: 2.3444,
                tooltip: {content : "<span style=\"font-weight:bold;\">City :</span> Paris"},
				text : {content : "Paris"}
			},
			'lyon' : {
				latitude :45.758888888889, 
				longitude: 4.8413888888889, 
				tooltip: {content : "<span style=\"font-weight:bold;\">City :</span> Lyon"},
				text : {content : "Lyon"}
			}
		}
	});
	
	$('#gotolyon').on('click', function() {
        $maparea2.trigger('zoom', {level : 10, latitude : 45.758888888889, longitude : 4.8413888888889});
	});
	
	$('#gotoparis').on('click', function() {
		$maparea2.trigger('zoom', {level : 10, latitude : 48.86, longitude : 2.3444});
	});
	
	$('#clearzoom').on('click', function() {
        $maparea2.trigger('zoom', {level : 0});
	});
});