Skip to content

Instantly share code, notes, and snippets.

@martpie

martpie/gmaps.html

Created Aug 20, 2014
Embed
What would you like to do?
Google Maps v3 API snippet
<!-- 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
You can’t perform that action at this time.