Created
March 23, 2016 09:16
-
-
Save karlbright/f48a8fb23c90d3d9ed57 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var film = [ | |
[ | |
"On the Waterfront","1954", | |
[ | |
[40.734059,-74.029192,"Hoboken Railway Station, Hoboken, New Jersey"], | |
[40.7424391,-74.033583,"Our Lady Of Grace Church - 400 Willow Avenue, Hoboken, New Jersey"] | |
] | |
] | |
]; | |
// Title = film[i][0] | |
// Year = film[i][1] | |
// Locations = film[i][2] | |
// Location Lng = film[i][2][l][0] | |
// Location Lat = film[i][2][l][1] | |
// Location Description = film[i][2][l][2] | |
function displaySingleFilm (item) { | |
// Get locations for the film | |
var locations = film[item.selectedIndex][2]; | |
// for each location in the film | |
for (var j = 0; j < locations.length; j++) { | |
// Add/show a marker for the location on the map | |
var lat = locations[j][0]; | |
var lng = locations[j][1]; | |
var description = locations[j][2]; | |
var marker = new google.maps.Marker({ | |
position: new google.maps.LatLng(lat,lng), | |
map: map | |
}); | |
// Add click event listener for info window on each location marker | |
google.maps.event.addListener(marker, 'click', (function(marker, i) { | |
infoWindow.setContent(description); | |
infoWindow.open(map, marker) | |
})(marker, description); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment