I'm having problems showing leaflet map in a bootstrap tab

£可爱£侵袭症+ 提交于 2019-12-25 08:21:32

问题


I'm trying to put a leaflet map on a bootstrap tab, but it's not working. Not showing at all or missing tiles and in the wrong position .

Does anyone have an idea how to fix that?

This is an example of the problem: missing tiles

This is my code: https://gist.github.com/h3kr/991ac0ee5a88d0cecba27e91c886675e


回答1:


You forgot to include the CSS file for Leaflet.

Let me quote the Leaflet docs:

The latest stable Leaflet release is hosted on a CDN — to start using it straight away, place this in the head of your HTML code:

<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.2/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.0.2/dist/leaflet.js"></script>


来源:https://stackoverflow.com/questions/40856063/im-having-problems-showing-leaflet-map-in-a-bootstrap-tab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!