javascript - how disable scrolling when bingmap focus? -
i have bingmap width , height more parent div. prent div set scrollable,
"when scrolling prent scroll bar down , click bingmap, parent scrolling top position"
"or scroll bottom , click outside bingmap , click inside can see scroll bars scrolling top"
how dissable effect?
<div style="overflow: auto; width: 400px; height: 200px;"> <div id='mymap' style='width: 100vw; height: 200vh;position: relative;'></div> </div> <script type='text/javascript'> var map; function loadmapscenario() { map = new microsoft.maps.map(document.getelementbyid('mymap'), { credentials: '' }); } </script> <script type='text/javascript' src='https://www.bing.com/api/maps/mapcontrol?callback=loadmapscenario' async defer></script>
finally added patch code. restore parent(my case window
) scroll position previous position. logic save scroll position when mouse down on map , restore when window scroll.
var scrollpositiony = -1; microsoft.maps.events.addhandler(map, 'mousedown', function(e){ scrollpositiony = document.documentelement.scrolltop || document.body.scrolltop; $(window).bind('scroll',preventwindowscroll); settimeout(function(){ $(window).unbind('scroll',preventwindowscroll); },100); }); function preventwindowscroll(e){ window.scrollto(0,scrollpositiony);//restore saved position e.preventdefault(); return false; }
Comments
Post a Comment