Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function initMap() {
- //console.log(centerCords);
- if (typeof(centerCords) == 'undefined') {
- centerCords = {
- lat: 32.8206297,
- lng: 35.0437161
- }
- }
- // 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: 17,
- //bounds: new google.maps.LatLngBounds(new google.maps.LatLng(centerCords.lat, centerCords.lng), new google.maps.LatLng(51.526, centerCords.lng)),
- disableDefaultUI: true, // a way to quickly hide all controls,
- zoomControl: true,
- // The latitude and longitude to center the map (always required)
- center: new google.maps.LatLng(centerCords.lat, centerCords.lng),
- // How you would like to style the map.
- // This is where you would paste any style found on Snazzy Maps.
- styles: [
- {
- "elementType": "geometry",
- "stylers": [
- {
- "color": "#f5f5f5"
- }
- ]
- },
- {
- "elementType": "labels.icon",
- "stylers": [
- {
- "visibility": "off"
- }
- ]
- },
- {
- "elementType": "labels.text.fill",
- "stylers": [
- {
- "color": "#616161"
- }
- ]
- },
- {
- "elementType": "labels.text.stroke",
- "stylers": [
- {
- "color": "#f5f5f5"
- }
- ]
- },
- {
- "featureType": "administrative.land_parcel",
- "stylers": [
- {
- "visibility": "off"
- }
- ]
- },
- {
- "featureType": "administrative.land_parcel",
- "elementType": "labels.text.fill",
- "stylers": [
- {
- "color": "#bdbdbd"
- }
- ]
- },
- {
- "featureType": "administrative.neighborhood",
- "stylers": [
- {
- "visibility": "off"
- }
- ]
- },
- {
- "featureType": "poi",
- "elementType": "geometry",
- "stylers": [
- {
- "color": "#eeeeee"
- }
- ]
- },
- {
- "featureType": "poi",
- "elementType": "labels.text",
- "stylers": [
- {
- "visibility": "off"
- }
- ]
- },
- {
- "featureType": "poi",
- "elementType": "labels.text.fill",
- "stylers": [
- {
- "color": "#757575"
- }
- ]
- },
- {
- "featureType": "poi.park",
- "elementType": "geometry",
- "stylers": [
- {
- "color": "#e5e5e5"
- }
- ]
- },
- {
- "featureType": "poi.park",
- "elementType": "labels.text.fill",
- "stylers": [
- {
- "color": "#9e9e9e"
- }
- ]
- },
- {
- "featureType": "road",
- "elementType": "geometry",
- "stylers": [
- {
- "color": "#ffffff"
- }
- ]
- },
- {
- "featureType": "road",
- "elementType": "labels",
- "stylers": [
- {
- "visibility": "off"
- }
- ]
- },
- {
- "featureType": "road.arterial",
- "elementType": "labels.text.fill",
- "stylers": [
- {
- "color": "#757575"
- }
- ]
- },
- {
- "featureType": "road.highway",
- "elementType": "geometry",
- "stylers": [
- {
- "color": "#dadada"
- }
- ]
- },
- {
- "featureType": "road.highway",
- "elementType": "labels.text.fill",
- "stylers": [
- {
- "color": "#616161"
- }
- ]
- },
- {
- "featureType": "road.local",
- "elementType": "labels.text.fill",
- "stylers": [
- {
- "color": "#9e9e9e"
- }
- ]
- },
- {
- "featureType": "transit.line",
- "elementType": "geometry",
- "stylers": [
- {
- "color": "#e5e5e5"
- }
- ]
- },
- {
- "featureType": "transit.station",
- "elementType": "geometry",
- "stylers": [
- {
- "color": "#eeeeee"
- }
- ]
- },
- {
- "featureType": "water",
- "elementType": "geometry",
- "stylers": [
- {
- "color": "#c9c9c9"
- }
- ]
- },
- {
- "featureType": "water",
- "elementType": "labels.text",
- "stylers": [
- {
- "visibility": "off"
- }
- ]
- },
- {
- "featureType": "water",
- "elementType": "labels.text.fill",
- "stylers": [
- {
- "color": "#9e9e9e"
- }
- ]
- }
- ]
- };
- // 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('map2');
- // Create the Google Map using our element and options defined above
- var map = new google.maps.Map(mapElement, mapOptions);
- // Resize Function
- google.maps.event.addDomListener(window, "resize", function () {
- var center = map.getCenter();
- google.maps.event.trigger(map, "resize");
- map.setCenter(center);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement