mirror of
https://github.com/tabler/tabler.git
synced 2026-08-25 20:34:25 +04:00
mapbox small fixes
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
{% if data %}
|
||||
<div class="embed-responsive embed-responsive-{{ data.ratio | default: include.ratio | default: '16by9' }}">
|
||||
<div class="embed-responsive-item">
|
||||
<div id="map-{{ id }}" class="w-100 h-100"></div>
|
||||
<div id="map-{{ id }}" class="w-100 h-100{% if data.card %} rounded{% endif %}"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
{% capture_global scripts %}
|
||||
<script>
|
||||
// @formatter:off
|
||||
{% if jekyll.environment == 'development' %}window.tabler_map = window.tabler_map || {};{% endif %}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
mapboxgl.accessToken = '{{ site.mapbox_key }}';
|
||||
var map = new mapboxgl.Map({
|
||||
@@ -19,11 +21,18 @@
|
||||
style: 'mapbox://styles/mapbox/{{ data.style | default: "streets-v11" }}',
|
||||
zoom: {{ data.zoom | default: 13 }},
|
||||
{% if data.center %}
|
||||
center: [{{ data.center[1] }}, {{ data.center[0] }}],
|
||||
center: [{{ data.center[1] }}, {{ data.center[0] }}],
|
||||
{% else %}
|
||||
center: [13.404900, 52.518827],
|
||||
center: [13.404900, 52.518827],
|
||||
{% endif %}
|
||||
});
|
||||
|
||||
{% for marker in data.markers %}
|
||||
|
||||
new mapboxgl.Marker({ color: "{{ 'blue' | tabler_color }}" }).setLngLat([{{ marker.center[1] }}, {{ marker.center[0] }}]).addTo(map);
|
||||
{% endfor %}
|
||||
|
||||
{% if jekyll.environment == 'development' %}window.tabler_map["map-{{ map-id }}"] = map;{% endif %}
|
||||
});
|
||||
// @formatter:on
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user