Select to view content in your preferred language

Double Click Zoom moves the map while using the map in an absolute positioned div

05-04-2021 10:20 PM
New Contributor

On one of our pages, we need to show the map in a certain location, whose parent tags has -at least- the css property position: absolute. So we have a html structure similar to this:


<div style="position: absolute; right: 0">

   <div style="posisiton: fixed; top: 0"> 


        <div id="map">   // This is where our map is


And in this case, a double click (or pinch-to-zoom on mobile) does not work nicely since the map content also moves somewhere else while zooming, so we lose our position in the map. (Although the zoom In/Out buttons on the map works fine and they never lose the orientation)

When i move our map's div (which itself does not have any additional css) to another location, which does not have any absolute or fixed positioning, everything works well.

Currently as a quick fix, we had to completely disable the double click function with disableDoubleClickZoom.

Do you have any idea how we can fix this problem?

0 Kudos
0 Replies