Created
August 20, 2014 09:31
-
-
Save martpie/58a91ce96948712ebd5c to your computer and use it in GitHub Desktop.
Google Maps v3 API snippet
This file contains 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
<!-- Map --> | |
<div id="map_canvas" class="relative" style="height:600px;z-index: 4;"></div> | |
<!-- Maps Generator --> | |
<script src="http://maps.google.com/maps/api/js?sensor=false"></script> | |
<script> | |
window.onload = function() { | |
initialize(); | |
} | |
function initialize() { | |
var adress = new google.maps.LatLng(46.667768, 6.799824); | |
var myStyle = [ // https://developers.google.com/maps/documentation/javascript/reference?hl=fr#MapTypeStyleFeatureType | |
{ | |
featureType: "administrative", | |
elementType: "labels", | |
stylers: [ | |
{ visibility: "on" } | |
] | |
},{ | |
featureType: "poi", | |
elementType: "labels", | |
stylers: [ | |
{ visibility: "off" } | |
] | |
},{ | |
featureType: "water", | |
elementType: "labels", | |
stylers: [ | |
{ visibility: "on" } | |
] | |
},{ | |
featureType: "road", | |
elementType: "labels", | |
stylers: [ | |
{ visibility: "on" } | |
] | |
},{ | |
featureType: "transit", | |
elementType: "labels", | |
stylers: [ | |
{ visibility: "on" } | |
] | |
} | |
]; | |
var myOptions = { // https://developers.google.com/maps/documentation/javascript/reference#MapOptions | |
zoom: 16, | |
center: adress, | |
disableDefaultUI: true, | |
navigationControl: false, | |
mapTypeControl: false, | |
streetViewControl: false, | |
mapTypeId: google.maps.MapTypeId.ROADMAP, | |
scrollwheel: false, | |
draggable: false, | |
clickable: false, | |
styles: myStyle | |
} | |
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); | |
var infowindow = new google.maps.InfoWindow({ | |
content: "" | |
}); | |
// Marker adress | |
var marker = new google.maps.Marker({ | |
position: adress, | |
map: map, | |
animation: google.maps.Animation.DROP, | |
title: '', | |
icon: '' | |
}); | |
// Place markers on the map | |
marker.setMap(map); | |
} | |
</script> | |
<!-- End Map --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment