Why map resize is not working when layout changes? #2525
-
I am trying to implement layout with map and sidebar. Everything seems to be working fine until I collapse sidebar (change its width to smaller value). After the sidebar is collapsed, the map should be extended to fill the rest with the space, but on the right side there is a blank space with the width of the collapsed sidebar. I was trying to use resize function when calling toggle sidebar method, but transition of the sidebar takes 0.3s, so resize will be called before animation is complete and blank space still be visible. I noticed that mapbox is tracking resize of the window, but not resize of the parent element.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You should call |
Beta Was this translation helpful? Give feedback.
You should call
map.resize
in the handler of the sidebar'sonTransitionEnd
event.