How can I add padding to the map area?
As you can see in the screenshot there is a yellow div overlaid over the top and the popup is appearing underneath it so I'd like to give the map area 100px padding to the top so the popup drops to the side. Thanks in advance.
Code below:
<div id="map" class="map"></div>
<script>
mapboxgl.accessToken = 'pk.xxxxxx';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/xxxxxx/cj5jggnud0m5g2soxqalq8z3n',
zoom: 3,
center: [50.075,26.136]
});
var geojson = {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: xx.xxxxx,xx.xxxxxx }}]
},
properties: {
title: 'Egypt',
description: 'Item One Item Two Item Three'
}
}
]
};
// add markers to map
geojson.features.forEach(function(marker) {
// create a HTML element for each feature
var el = document.createElement('div');
el.className = 'marker';
// make a marker for each feature and add to the map
new mapboxgl.Marker(el, { offset: [-50 / 2, -50 / 2] })
.setLngLat(marker.geometry.coordinates)
.setPopup(new mapboxgl.Popup({ offset: 25 }) // add popups
.setHTML('<div class="map-marker"><h3>' + marker.properties.title + '</h3><p>' + marker.properties.description + '</p></div>'))
.addTo(map);
});
// disable map zoom when using scroll
map.scrollZoom.disable();
// Add zoom and rotation controls to the map.
var nav = new mapboxgl.NavigationControl();
map.addControl(nav, 'bottom-right');
</script>
