//https://developers.google.com/maps/documentation/javascript/examples/layer-kml-features
$(document).ready(function() {
initMap();
});
var locations = []
var data
var markerData
$('.map').each(function(get) { //gather data from html and store
data = $(this).data();
markerData = ([data.txt, data.lat, data.lng])
locations.push(markerData);
});
function initMap() {
var infowindow = new google.maps.InfoWindow(); /* SINGLE */
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 14,
center: {
lat: 50.07821,
lng: 8.23976
}
});
// Create an array of alphabetical characters used to label the markers.
var labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
// Add some markers to the map.
// Note: The code uses the JavaScript Array.prototype.map() method to
// create an array of markers based on a given "locations" array.
// The map() method here has nothing to do with the Google Maps API.
var markers = locations.map(function(loc, i) {
var marker = new google.maps.Marker({
position: new google.maps.LatLng(loc[1], loc[2]),
animation: google.maps.Animation.DROP,
label: labels[i % labels.length]
});
console.log("loc[0]="+loc[0])
google.maps.event.addListener(marker, 'click', (function(loc) {
return function(evt) {
console.log('hit')
infowindow.close(); // Close previously opened infowindow
infowindow.setContent("<div id='infowindow'>" + loc[0] + "</div>");
console.log("loc[0]="+loc[0])
infowindow.open(map, marker);
}}(loc)));
return marker
});
// Add a marker clusterer to manage the markers.
var markerCluster = new MarkerClusterer(map, markers, {
imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'
});
}
// this part for isotope
var $grid = $('.isotope-index').isotope({
itemSelector: '.isotope-listing',
stagger: 300,
getSortData: {
name: 'h5'
},
sortBy:...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.