Skip to content

Commit

Permalink
autoload
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperknot committed Jan 19, 2024
1 parent f434c62 commit c800337
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
14 changes: 10 additions & 4 deletions website/assets/map_howto.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ function initMap() {
})
window.map = map

map.once('idle', () => {
document.getElementById('mapbg-image').remove()
})

let nav = new maplibregl.NavigationControl({ showCompass: false })
map.addControl(nav, 'top-right')

Expand All @@ -24,12 +28,14 @@ function initMap() {
}

const mapDiv = document.getElementById('map-container')
mapDiv.onclick = function () {
initMap()
}
// mapDiv.onclick = function () {
// initMap()
// }

initMap()

function selectStyle(style) {
initMap()
// initMap()

const styleUrl = 'https://tiles.openfreemap.org/styles/' + style
map.setStyle(styleUrl)
Expand Down
7 changes: 6 additions & 1 deletion website/assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,14 @@ code {
width: 100%;
height: 500px;
margin-bottom: 2em;
position: relative;
}

#map-container:not(.maplibregl-map) {
#mapbg-image {
width: 100%;
height: 100%;
position: absolute;
z-index: 1;
background-image: url('mapbg.jpg');
background-size: cover;
background-position: center;
Expand Down
4 changes: 3 additions & 1 deletion website/blocks/map_howto.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<div id="map-container"></div>
<div id="map-container">
<div id="mapbg-image"></div>
</div>

<p>Choose a style:</p>
<div class="button-container">
Expand Down

0 comments on commit c800337

Please sign in to comment.