Created
August 6, 2015 19:49
-
-
Save tim-br/96c265734d4087cbf292 to your computer and use it in GitHub Desktop.
gmaps_ex1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"> | |
<meta charset="utf-8"> | |
<title>Simple markers</title> | |
<style> | |
html, body, #map-canvas { | |
height: 100%; | |
margin: 0; | |
padding: 0; | |
} | |
</style> | |
<script src="https://maps.googleapis.com/maps/api/js?key=<API_KEY>"></script> | |
<script> | |
function initialize() { | |
var theirLatlng = new google.maps.LatLng(-25.363882,131.044922); | |
var myLatlng = new google.maps.LatLng(49.2724415,-123.1194481); | |
var mapOptions = { | |
zoom: 10, | |
center: myLatlng | |
} | |
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); | |
var myMarker = new google.maps.Marker({ | |
position: myLatlng, | |
map: map, | |
draggable:true, | |
title: 'Hello World!' | |
}); | |
var theirMarker = new google.maps.Marker({ | |
position: theirMarker, | |
map: map, | |
title: 'Hello World!' | |
}); | |
google.maps.event.addListener(myMarker, 'click', function(){ | |
if (myMarker.getAnimation() != null) { | |
myMarker.setAnimation(null); | |
} else { | |
myMarker.setAnimation(google.maps.Animation.BOUNCE); | |
} | |
}); | |
} | |
google.maps.event.addDomListener(window, 'load', initialize); | |
</script> | |
</head> | |
<body> | |
<div id="map-canvas"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment