Skip to content

Commit b640353

Browse files
committed
fix: incorrect Leaflet attribution display on mobile due to 100vh issue.
1 parent ecbe11a commit b640353

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

online/meteorites-map.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
}
2929

3030
#map {
31-
height: 100vh;
31+
height: calc(var(--vh, 1vh) * 100);
3232
z-index: 0;
3333
}
3434

@@ -710,6 +710,8 @@ <h2>Top ${extendedData.ranking} des classes de météorites:</h2>
710710

711711
}
712712

713+
function setRealVH() { return $('html').css('--vh', `${(window.innerHeight * 0.01)}px`); }
714+
713715
L.Control.DropdownControl = L.Control.extend({
714716

715717
onAdd: function (map) {
@@ -836,7 +838,9 @@ <h2>Top ${extendedData.ranking} des classes de météorites:</h2>
836838

837839
window.onload = () => {
838840

839-
detectES6();
841+
detectES6();
842+
843+
setRealVH();
840844

841845
if ($(window).width() <= 768) {
842846

@@ -896,6 +900,8 @@ <h2>Top ${extendedData.ranking} des classes de météorites:</h2>
896900

897901
extendedData.marker_group = L.layerGroup().addTo(extendedData.map);
898902

903+
$(window).on('resize orientationchange', function () { setRealVH(); });
904+
899905
document.oncontextmenu = () => { return false; }
900906

901907
</script>

0 commit comments

Comments
 (0)