Leaflet in map iFrame scroll issue

115 views
Skip to first unread message

Kevin Kicks

unread,
Apr 8, 2022, 9:48:23 AM4/8/22
to Leaflet
Hi,
I have an iFrame showing a map using leaflet part way down my webpage.
The problem is that when a user scrolls down on a touch device the page scrolls but as soon as the scrolling reaches the iFrame content then the scrolling occurs within the map. Then it's not possible to scroll the page any further. So I've tried to dynamically to set the iFrame width in javascript to leave some space at the side but that doesn't work - it sems as though it's not possible to set the width on an Iframe, it just goes to the window width. I've noticed that embedded Google maps mandate the user to use Ctrl + scroll which overcomes this issue. Ant ideas ?

Joseph Elfelt

unread,
Apr 14, 2022, 8:01:33 AM4/14/22
to leafl...@googlegroups.com
if(window.self !== window.top) {
// map is in iframe
masu.map_in_iframe = true;
}

if(masu.map_in_iframe !== false) {
// map is in iframe
masu.map_zoom_control_option = true;
map_scrollwheel_option = false;
} else {
// map is NOT in iframe
masu.map_zoom_control_option = false;
map_scrollwheel_option = true;
}

masu.map = L.map('map', {
zoomControl: false, // zoom control maybe added later so it is below any title
scrollWheelZoom: map_scrollwheel_option,
attributionControl: true
});

--

---
You received this message because you are subscribed to the Google Groups "Leaflet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leaflet-js+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leaflet-js/84a5e0b5-4d28-435f-a521-e323f1e49f94n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages