daily pastebin goal
57%
SHARE
TWEET

Untitled

a guest Mar 25th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. var map;
  3. var baku = {lat: 40.4093, lng: 49.8671}
  4. var brooklyn = {lat:40.6782, lng: -73.9442}
  5. var israel = {lat: 31.7683, lng: 35.2137}
  6.  
  7.  
  8. function clearNavs() {
  9.     var navs = document.getElementsByClassName("navitem")
  10.     //console.log(navs)
  11.     for(var i = 0; i < navs.length; i++) {
  12.         navs[i].className = "navitem"
  13.     }
  14. }
  15.  
  16. function setNavTo(id) {
  17.     document.getElementById(id).className = "navitem selected"
  18. }
  19.  
  20. function gotoBrooklyn() {
  21.     clearNavs()
  22.     setNavTo("brooklyn")
  23.     map.panTo(brooklyn)
  24.     map.setZoom(12)
  25.     var desc = document.getElementById("description")
  26.     desc.innerHTML = "We currently live in Brooklyn, New York."
  27. }
  28.  
  29. function gotoBaku() {
  30.     clearNavs()
  31.     setNavTo("baku")
  32.     map.panTo(baku)
  33.     map.setZoom(8)
  34.     var desc = document.getElementById("description")
  35.     desc.innerHTML = "My mother's side of the family comes from Baku, Azerbijan."
  36. }
  37.  
  38. function gotoIsrael() {
  39.     clearNavs()
  40.     setNavTo("israel")
  41.     map.panTo(israel)
  42.     map.setZoom(8)
  43.     var desc = document.getElementById("description")
  44.     desc.innerHTML = "My father's side of the family comes from Jerusalem, Israel."
  45. }
  46.  
  47.  
  48.  
  49.  
  50.  
  51. function initMap() {
  52.     map = new google.maps.Map(document.getElementById('themap'), {
  53.         center: brooklyn,
  54.         zoom: 6
  55.     });
  56.     gotoBrooklyn()
  57.     var icon = {
  58.         url: "http://eskaykids.com.au/wp-content/uploads/2017/08/location-icon.png", // url
  59.         scaledSize: new google.maps.Size(50, 50), // scaled size
  60.         origin: new google.maps.Point(0, 0), // origin
  61.         anchor: new google.maps.Point(25, 50) // anchor
  62.     };
  63.     var bakuMarker = new google.maps.Marker({
  64.         position: baku,
  65.         map: map,
  66.         icon: icon
  67.     });
  68.     var brooklynMarker = new google.maps.Marker({
  69.         position: brooklyn,
  70.         map: map,
  71.         icon: icon
  72.     });
  73.     var israelMarker = new google.maps.Marker({
  74.         position: israel,
  75.         map: map,
  76.         icon: icon
  77.     });
  78.    
  79.     israelMarker.addListener('click', gotoIsrael)
  80.     bakuMarker.addListener('click', gotoBaku)
  81.     broojlynMarker.addListener('click', gotoBrooklyn)
  82. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top