Skip to content

Instantly share code, notes, and snippets.

@liviucerchez
Created October 3, 2019 07:15
Embed
What would you like to do?
Peter - Contact Map
<div class="responsive-container no-bottom">
<div class="responsive-wrapper">
<div id="gmap" class="map"></div>
</div>
</div>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false&amp;key=API_KEY"></script>
<script>
jQuery(function() {
if (typeof(google) !== "undefined") {
var map_name = 'custom_gmap',
// set location
location = new google.maps.LatLng(40.796146, -73.960157),
// set marker position
marker_pos = new google.maps.LatLng(40.796146, -73.960157),
marker_title = 'Peter',
stylers = [{
"featureType": "all",
"elementType": "all",
"stylers": [ { "saturation": "-80" }, { "lightness": 20 } ]
}],
mapOptions = { zoom: 12, center: location, mapTypeId: map_name, mapTypeControl: false, scrollwheel: false },
map = new google.maps.Map(document.getElementById("gmap"), mapOptions),
styledMapOptions = { map: map, name: map_name + "_map" },
marker = new google.maps.Marker({
position: marker_pos,
map: map,
title: marker_title,
icon: 'https://liviucerchez.com/peter/wp-content/uploads/sites/18/2016/04/sample-marker.png'
}),
custommap = new google.maps.StyledMapType(stylers,styledMapOptions);
map.mapTypes.set(map_name, custommap);
map.setMapTypeId(map_name);
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment