Cannot set map's div height for openlayers map

前端 未结 5 1424
予麋鹿
予麋鹿 2021-01-05 23:25

This code make the map\'s div width max but height to 0 (the % value doesn\'t matter, it\'s always 0)

5条回答
  •  渐次进展
    2021-01-06 00:04

    I've resolved this for my use-case by adding:

    setInterval(function(){map.updateSize();}, 500);
    

    Update: This is no loner what I do under OpenLayers 3. I did this while using OpenLayers 2. I'm not saying it's pretty, but it was good enough for what I needed.

提交回复
热议问题