Skip to content

Instantly share code, notes, and snippets.

@Edwardtonnn
Created July 17, 2018 17:53
Show Gist options
  • Save Edwardtonnn/d857866d277fdf948d1edecd1e0ba465 to your computer and use it in GitHub Desktop.
Save Edwardtonnn/d857866d277fdf948d1edecd1e0ba465 to your computer and use it in GitHub Desktop.
Snazzy Maps Layout
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<style type="text/css">
/* Set a size for our map container, the Google Map will take up 100% of this container */
#map {
width: 100%;
height: 350px;
}
</style>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDAWKWRWa-edgDPScF7Ke4tJTm3R9I4S9s"></script>
<script type="text/javascript">
// When the window has finished loading create our google map below
google.maps.event.addDomListener(window, 'load', init);
function init() {
// Basic options for a simple Google Map
// For more options see: https://developers.google.com/maps/documentation/javascript/reference#MapOptions
var mapOptions = {
// How zoomed in you want the map to start at (always required)
zoom: 18,
// The latitude and longitude to center the map (always required)
center: new google.maps.LatLng(45.44529, -122.773621), // New York
// How you would like to style the map.
// This is where you would paste any style found on Snazzy Maps.
styles:
[
{
"featureType": "all",
"elementType": "labels.text.stroke",
"stylers": [
{
"visibility": "on"
}
]
},
{
"featureType": "administrative",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#2ac4f4"
}
]
},
{
"featureType": "administrative.country",
"elementType": "geometry.fill",
"stylers": [
{
"saturation": "13"
},
{
"lightness": "-4"
},
{
"visibility": "on"
}
]
},
{
"featureType": "administrative.country",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#027099"
}
]
},
{
"featureType": "administrative.neighborhood",
"elementType": "labels.text",
"stylers": [
{
"color": "#027099"
},
{
"saturation": "0"
}
]
},
{
"featureType": "administrative.neighborhood",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#027099"
},
{
"saturation": "0"
}
]
},
{
"featureType": "administrative.neighborhood",
"elementType": "labels.text.stroke",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "landscape",
"elementType": "all",
"stylers": [
{
"color": "#ffffff"
}
]
},
{
"featureType": "landscape",
"elementType": "geometry",
"stylers": [
{
"visibility": "on"
},
{
"color": "#ffffff"
}
]
},
{
"featureType": "landscape",
"elementType": "geometry.stroke",
"stylers": [
{
"weight": "0.62"
},
{
"color": "#eeeeee"
},
{
"visibility": "on"
}
]
},
{
"featureType": "landscape.natural.landcover",
"elementType": "geometry.fill",
"stylers": [
{
"color": "#ff0000"
},
{
"visibility": "off"
}
]
},
{
"featureType": "poi",
"elementType": "all",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "road",
"elementType": "all",
"stylers": [
{
"saturation": -100
},
{
"lightness": 45
},
{
"visibility": "on"
}
]
},
{
"featureType": "road",
"elementType": "labels.text",
"stylers": [
{
"visibility": "simplified"
},
{
"color": "#027099"
}
]
},
{
"featureType": "road",
"elementType": "labels.text.fill",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "road",
"elementType": "labels.text.stroke",
"stylers": [
{
"visibility": "on"
}
]
},
{
"featureType": "road.highway",
"elementType": "all",
"stylers": [
{
"visibility": "simplified"
}
]
},
{
"featureType": "road.highway",
"elementType": "geometry.fill",
"stylers": [
{
"color": "#eccca8"
},
{
"visibility": "off"
}
]
},
{
"featureType": "road.highway",
"elementType": "geometry.stroke",
"stylers": [
{
"color": "#713700"
},
{
"visibility": "off"
}
]
},
{
"featureType": "road.highway",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#1a1a1a"
},
{
"visibility": "on"
}
]
},
{
"featureType": "road.arterial",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "transit",
"elementType": "all",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "water",
"elementType": "all",
"stylers": [
{
"color": "#027099"
},
{
"visibility": "on"
},
{
"lightness": "1"
},
{
"saturation": "3"
},
{
"gamma": "3.77"
},
{
"weight": "1.25"
}
]
}
]
};
// Get the HTML DOM element that will contain your map
// We are using a div with id="map" seen below in the <body>
var mapElement = document.getElementById('map');
// Create the Google Map using our element and options defined above
var map = new google.maps.Map(mapElement, mapOptions);
// Let's also add a marker while we're at it
var marker = new google.maps.Marker({
position: new google.maps.LatLng(45.44529, -122.773621),
map: map,
title: 'Launch Lab Long Beach'
});
}
</script>
<div id="map">
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment