Skip to content

Instantly share code, notes, and snippets.

@davilera
Last active November 15, 2018 12:33
Show Gist options
  • Save davilera/ba57d46f0765154fa360b9ef0d7399cc to your computer and use it in GitHub Desktop.
Save davilera/ba57d46f0765154fa360b9ef0d7399cc to your computer and use it in GitHub Desktop.

Google Maps JavaScript API Example.

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=TU_CLAVE_DE_API_AQUI"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOU_API_KEY_HERE"></script>
function loadNelioHQMap() {
// Code here.
}
google.maps.event.addDomListener( window, 'load', loadNelioHQMap );
var mapEl = document.getElementById( 'neliohq-map' );
var mapOptions = {
center: new google.maps.LatLng( 41.406424, 2.192606 ),
disableDoubleClickZoom: true,
draggable : true,
mapTypeControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP,
panControl: true,
scaleControl: false,
scrollwheel: true,
streetViewControl: false,
overviewMapControl: true,
overviewMapControlOptions: {
opened: false,
},
zoom: 12,
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.DEFAULT,
}
};
var map = new google.maps.Map( mapEl, mapOptions );
new google.maps.Marker({
map: map,
position: new google.maps.LatLng( 41.406424, 2.192606 ),
icon: {
path: google.maps.SymbolPath.CIRCLE,
fillColor: '#80c6dd',
fillOpacity: 1,
scale: 6,
strokeWeight: 6,
strokeColor: '#80c6dd'
}
});
var mapOptions = {
// ...
styles: [{"featureType":"water","elementType":"geometry", /* ... */ }]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment