13 lines
516 B
JavaScript
13 lines
516 B
JavaScript
|
// only load the map viewer when it's visible (and javascript is enabled)
|
||
|
document.addEventListener('DOMContentLoaded', (event) => {
|
||
|
const setMap = () => { document.querySelector('#map').src = 'map/' }
|
||
|
const details = document.querySelector('details:last-child')
|
||
|
|
||
|
// if <details> is not supported (looking at you, Edge), the frame will be
|
||
|
// visible by default, so just set the target immediately
|
||
|
if ('open' in details)
|
||
|
details.addEventListener('toggle', setMap, { once: true })
|
||
|
else
|
||
|
setMap()
|
||
|
})
|