function toggle_index() {
// Find elements to toggle
var list = document.getElementById("list");
var map = document.getElementById("map");
var button = document.getElementById("toggle_button");
// Toggle between displays
if (list.style.display == "block") {
list.style.display = "none";
map.style.display = "block";
button.innerHTML = "Show list view";
}
else {
map.style.display = "none";
list.style.display = "block";
button.innerHTML = "Show map view";
}
};
function addMap() {
// Add map
var map = L.map("map", {
center: [46.5, -94.6],
zoom: 6
});
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
minZoom: 6,
attribution: '© OpenStreetMap contributors'
}).addTo(map);
// Add a marker for each park
var greenIcon = new L.Icon({
iconUrl: '/static/img/marker-icon-green.png',
shadowUrl: '/static/img/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
shadowSize: [41, 41]
});
var yellowIcon = new L.Icon({
iconUrl: '/static/img/marker-icon-gold.png',
shadowUrl: '/static/img/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
shadowSize: [41, 41]
});
var redIcon = new L.Icon({
iconUrl: '/static/img/marker-icon-red.png',
shadowUrl: '/static/img/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
shadowSize: [41, 41]
});
L.marker([44.72505, -92.84999], {icon:
redIcon
}).addTo(map)
.bindPopup('Vermillion Falls Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([48.00055, -89.59312], {icon:
yellowIcon
}).addTo(map)
.bindPopup('Grand Portage State Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([44.06227, -92.04486], {icon:
redIcon
}).addTo(map)
.bindPopup('Whitewater State Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([45.22504, -92.76562], {icon:
redIcon
}).addTo(map)
.bindPopup('William O\'Brien State Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([45.31376, -93.94101], {icon:
greenIcon
}).addTo(map)
.bindPopup('Lake Maria State Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([43.63729, -93.30918], {icon:
redIcon
}).addTo(map)
.bindPopup('Myre-Big Island State Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([46.13559, -93.72518], {icon:
greenIcon
}).addTo(map)
.bindPopup('Mille Lacs Kathio State Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([44.84681, -92.79139], {icon:
redIcon
}).addTo(map)
.bindPopup('Afton State Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([45.94622, -92.60659], {icon:
greenIcon
}).addTo(map)
.bindPopup('St\. Croix State Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([46.17349, -92.84968], {icon:
greenIcon
}).addTo(map)
.bindPopup('Banning State Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([45.39366, -92.66899], {icon:
redIcon
}).addTo(map)
.bindPopup('Interstate State Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([43.93956, -91.40834], {icon:
redIcon
}).addTo(map)
.bindPopup('Great River Bluffs State Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([47.33848, -91.19606], {icon:
yellowIcon
}).addTo(map)
.bindPopup('Tettegouche State Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([44.34225, -93.10519], {icon:
redIcon
}).addTo(map)
.bindPopup('Nerstrand Big Woods State Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([44.52373, -92.34214], {icon:
redIcon
}).addTo(map)
.bindPopup('Frontenac State Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([46.65433, -92.37127], {icon:
greenIcon
}).addTo(map)
.bindPopup('Jay Cooke State Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([47.14092, -91.46971], {icon:
yellowIcon
}).addTo(map)
.bindPopup('Gooseberry Falls State Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([44.78643, -93.12888], {icon:
redIcon
}).addTo(map)
.bindPopup('Lebanon Hills Regional Park')
.on('click', (e) => {e.target.openPopup()});
L.marker([44.76568, -92.93711], {icon:
redIcon
}).addTo(map)
.bindPopup('Spring Lake Park Reserve')
.on('click', (e) => {e.target.openPopup()});
};
addEventListener("load", addMap);