Skip to content

Instantly share code, notes, and snippets.

@omas
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save omas/461093c34040054aef94 to your computer and use it in GitHub Desktop.

Select an option

Save omas/461093c34040054aef94 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
</style>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<script>
var map;
$(function(){
map = new google.maps.Map($('#map-canvas')[0],{
zoom: 16
});
navigator.geolocation.getCurrentPosition(function(position) {
var pos = new google.maps.LatLng(
position.coords.latitude - 1,
position.coords.longitude - 1);
map.setCenter(pos);
});
var infowindow = new google.maps.InfoWindow({
map: map,
position: new google.maps.LatLng(
26.210701,127.686074
),
content: '<a href="http://www.it-college.ac.jp">IT College Okinawa</a>'
});
$("#button").click(function(){
map.setMapTypeId(google.maps.MapTypeId.HYBRID);
});
});
</script>
<button id="button">click me!</button>
<div id="map-canvas"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment