This is a copy from OL2 trac ticket #1727:
In the case where users have a small map div, it would be nice if they could have their popups go beyond the restrictive limits of the map div... ie live outside the openlayers div itself.
The complication of this is that it will be more difficult for the popup to move with the map as it is panned.
To get a quick solution working, we can make the default behavior for these popups be to disappear when the map is panned (see
#1726)
The unsettled question is what to do with popups if the referred marker is moved out of the map entirely. This alone makes the whole feature questionable; however it would still be useful in certain cases (e.g. if the map viewport is constant). Alternatively, as proposed in the original ticket, the popup could just disappear if the map is panned or zoomed.
As I'm interested in this feature as a user (designers _always_ design popups that way!), I'm curious to hear from developers side:
Want to back this issue? Place a bounty on it! We accept bounties via Bountysource.
I can see how this would be a nice feature for some situations. Currently, overlays are contained in the .ol-viewport directly, which has overflow:hidden. I would guess that you would need to either:
overflow:hidden from the '.ol-viewportand introduced another level of divs, say.ol-clippedand.ol-unclipped` and place popovers into one or the other.parentElement property to overlays that would position overlays within a specific parent rather than the viewport. This would require calculating the pixel position of the overlay with respect to the parentElement instead of the viewport, which is probably reasonably easy using offsetParent.you can already do this, can't you? I've not tried it, so not sure whether there are issues, but you can assign any DOM element to the Overlay; it doesn't have to be in the map container but can be displayed anywhere in the viewport.
Removing overflow: hidden from the .ol-viewport works
Most helpful comment
Removing
overflow: hiddenfrom the.ol-viewportworks