'
+ '
'
);
infowindow.open(map, marker);
}
})(marker, i));
markers.push(marker);
//extend the bounds to include each marker's position
bounds.extend(marker.position);
}
//now fit the map to the newly inclusive bounds
map.fitBounds(bounds);
google.maps.event.addListenerOnce(map, 'bounds_changed', function(event) {
limitMaxZoom();
});
// Clustering
var options = {
gridSize: 25,
imagePath: 'https://www.canadiantx.org/media/com_mtree/images/m'
};
var markerCluster = new MarkerClusterer(map, markers, options);
jQuery(".toggleMap").on("click", function () {
jQuery("#map").slideToggle("slow", function() {
google.maps.event.trigger(map, "resize");
map.fitBounds(bounds);
limitMaxZoom();
});
jQuery("span", this).text(jQuery("span",this).text() == "Hide map" ? "Show map" : "Hide map");
return false;
});
function limitMaxZoom(){
var maxZoom = 15;
if (map.getZoom() > maxZoom) {
map.setZoom(maxZoom);
}
}
'
// + locations[i][4]
+ '
'
+ ''
+ 'Read more'
+ '
'
+ '