Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function initMap() {
  2.  
  3.     //console.log(centerCords);
  4.     if (typeof(centerCords) == 'undefined') {
  5.         centerCords = {
  6.             lat: 32.8206297,
  7.             lng: 35.0437161
  8.         }
  9.     }
  10.  
  11.     // Basic options for a simple Google Map
  12.     // For more options see: https://developers.google.com/maps/documentation/javascript/reference#MapOptions
  13.     var mapOptions = {
  14.         // How zoomed in you want the map to start at (always required)
  15.  
  16.         zoom: 17,
  17.  
  18.         //bounds: new google.maps.LatLngBounds(new google.maps.LatLng(centerCords.lat, centerCords.lng), new google.maps.LatLng(51.526, centerCords.lng)),
  19.  
  20.         disableDefaultUI: true, // a way to quickly hide all controls,
  21.         zoomControl: true,
  22.  
  23.         // The latitude and longitude to center the map (always required)
  24.         center: new google.maps.LatLng(centerCords.lat, centerCords.lng),
  25.  
  26.         // How you would like to style the map.
  27.         // This is where you would paste any style found on Snazzy Maps.
  28.         styles: [
  29.             {
  30.                 "elementType": "geometry",
  31.                 "stylers": [
  32.                     {
  33.                         "color": "#f5f5f5"
  34.                     }
  35.                 ]
  36.             },
  37.             {
  38.                 "elementType": "labels.icon",
  39.                 "stylers": [
  40.                     {
  41.                         "visibility": "off"
  42.                     }
  43.                 ]
  44.             },
  45.             {
  46.                 "elementType": "labels.text.fill",
  47.                 "stylers": [
  48.                     {
  49.                         "color": "#616161"
  50.                     }
  51.                 ]
  52.             },
  53.             {
  54.                 "elementType": "labels.text.stroke",
  55.                 "stylers": [
  56.                     {
  57.                         "color": "#f5f5f5"
  58.                     }
  59.                 ]
  60.             },
  61.             {
  62.                 "featureType": "administrative.land_parcel",
  63.                 "stylers": [
  64.                     {
  65.                         "visibility": "off"
  66.                     }
  67.                 ]
  68.             },
  69.             {
  70.                 "featureType": "administrative.land_parcel",
  71.                 "elementType": "labels.text.fill",
  72.                 "stylers": [
  73.                     {
  74.                         "color": "#bdbdbd"
  75.                     }
  76.                 ]
  77.             },
  78.             {
  79.                 "featureType": "administrative.neighborhood",
  80.                 "stylers": [
  81.                     {
  82.                         "visibility": "off"
  83.                     }
  84.                 ]
  85.             },
  86.             {
  87.                 "featureType": "poi",
  88.                 "elementType": "geometry",
  89.                 "stylers": [
  90.                     {
  91.                         "color": "#eeeeee"
  92.                     }
  93.                 ]
  94.             },
  95.             {
  96.                 "featureType": "poi",
  97.                 "elementType": "labels.text",
  98.                 "stylers": [
  99.                     {
  100.                         "visibility": "off"
  101.                     }
  102.                 ]
  103.             },
  104.             {
  105.                 "featureType": "poi",
  106.                 "elementType": "labels.text.fill",
  107.                 "stylers": [
  108.                     {
  109.                         "color": "#757575"
  110.                     }
  111.                 ]
  112.             },
  113.             {
  114.                 "featureType": "poi.park",
  115.                 "elementType": "geometry",
  116.                 "stylers": [
  117.                     {
  118.                         "color": "#e5e5e5"
  119.                     }
  120.                 ]
  121.             },
  122.             {
  123.                 "featureType": "poi.park",
  124.                 "elementType": "labels.text.fill",
  125.                 "stylers": [
  126.                     {
  127.                         "color": "#9e9e9e"
  128.                     }
  129.                 ]
  130.             },
  131.             {
  132.                 "featureType": "road",
  133.                 "elementType": "geometry",
  134.                 "stylers": [
  135.                     {
  136.                         "color": "#ffffff"
  137.                     }
  138.                 ]
  139.             },
  140.             {
  141.                 "featureType": "road",
  142.                 "elementType": "labels",
  143.                 "stylers": [
  144.                     {
  145.                         "visibility": "off"
  146.                     }
  147.                 ]
  148.             },
  149.             {
  150.                 "featureType": "road.arterial",
  151.                 "elementType": "labels.text.fill",
  152.                 "stylers": [
  153.                     {
  154.                         "color": "#757575"
  155.                     }
  156.                 ]
  157.             },
  158.             {
  159.                 "featureType": "road.highway",
  160.                 "elementType": "geometry",
  161.                 "stylers": [
  162.                     {
  163.                         "color": "#dadada"
  164.                     }
  165.                 ]
  166.             },
  167.             {
  168.                 "featureType": "road.highway",
  169.                 "elementType": "labels.text.fill",
  170.                 "stylers": [
  171.                     {
  172.                         "color": "#616161"
  173.                     }
  174.                 ]
  175.             },
  176.             {
  177.                 "featureType": "road.local",
  178.                 "elementType": "labels.text.fill",
  179.                 "stylers": [
  180.                     {
  181.                         "color": "#9e9e9e"
  182.                     }
  183.                 ]
  184.             },
  185.             {
  186.                 "featureType": "transit.line",
  187.                 "elementType": "geometry",
  188.                 "stylers": [
  189.                     {
  190.                         "color": "#e5e5e5"
  191.                     }
  192.                 ]
  193.             },
  194.             {
  195.                 "featureType": "transit.station",
  196.                 "elementType": "geometry",
  197.                 "stylers": [
  198.                     {
  199.                         "color": "#eeeeee"
  200.                     }
  201.                 ]
  202.             },
  203.             {
  204.                 "featureType": "water",
  205.                 "elementType": "geometry",
  206.                 "stylers": [
  207.                     {
  208.                         "color": "#c9c9c9"
  209.                     }
  210.                 ]
  211.             },
  212.             {
  213.                 "featureType": "water",
  214.                 "elementType": "labels.text",
  215.                 "stylers": [
  216.                     {
  217.                         "visibility": "off"
  218.                     }
  219.                 ]
  220.             },
  221.             {
  222.                 "featureType": "water",
  223.                 "elementType": "labels.text.fill",
  224.                 "stylers": [
  225.                     {
  226.                         "color": "#9e9e9e"
  227.                     }
  228.                 ]
  229.             }
  230.         ]
  231.     };
  232.  
  233.  
  234.     // Get the HTML DOM element that will contain your map
  235.     // We are using a div with id="map" seen below in the <body>
  236.     var mapElement = document.getElementById('map2');
  237.  
  238.     // Create the Google Map using our element and options defined above
  239.     var map = new google.maps.Map(mapElement, mapOptions);
  240.  
  241.     // Resize Function
  242.     google.maps.event.addDomListener(window, "resize", function () {
  243.         var center = map.getCenter();
  244.         google.maps.event.trigger(map, "resize");
  245.         map.setCenter(center);
  246.     });
  247.  
  248. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement