googlemaps-v3-utility-library
Version:
Google Maps API V3 Utility Library
53 lines (47 loc) • 1.89 kB
HTML
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Drag Zoom with Visual Control</title>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?v=3&sensor=false"></script>
</script>
<script type="text/javascript">
document.write('<script type="text/javascript" src="../src/keydragzoom'+(document.location.search.indexOf('packed')>-1?'_packed':'')+'.js"><'+'/script>');
</script>
<script type="text/javascript">
var map;
function init() {
var myOptions = {
zoom: 13,
center: new google.maps.LatLng(49.2903, -123.1294),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map"), myOptions);
map.enableKeyDragZoom({
visualEnabled: true,
visualPosition: google.maps.ControlPosition.LEFT,
visualPositionOffset: new google.maps.Size(35, 0),
visualPositionIndex: null,
visualSprite: "http://maps.gstatic.com/mapfiles/ftr/controls/dragzoom_btn.png",
visualSize: new google.maps.Size(20, 20),
visualTips: {
off: "Turn on",
on: "Turn off"
}
});
}
</script>
<style>
#map {
width: 700px;
height: 500px;
}
</style>
</head>
<body onload="init()">
<a href='?packed'>Packed</a> | <a href='?'>Unpacked</a> Version of the script.
<br />
Hold down the <span style="color: red; font-weight: bold;" >Shift</span> key while dragging a box or use the visual control below the zoom control to turn drag zoom on and off.
<div id="map" style="border: 2px solid black;"></div>
</body>
</html>