I have 2 standard mapbox mapbox-gl-geocoder containers one over another. And when the search results from the first one appears in the drop down list, the second container overlays the results. I tried css z-index 1000 over li, ul etc., but nothing works. Now I ended up with
geocoderStart.on('results', function(ev) {
document.getElementById('geocoderEnd').style.visibility = "hidden";
});
geocoderStart._inputEl.addEventListener('input', function (e) { document.getElementById('geocoderEnd').style.visibility = "hidden"; });
geocoderStart._inputEl.addEventListener('blur', function (e) { document.getElementById('geocoderEnd').style.visibility = "visible"; });
but it is buggy. Is there a simple css way to overlay second input with li results? Thanks
My Code
const geocoderStart = new MapboxGeocoder({
accessToken: mapboxgl.accessToken,
mapboxgl: mapboxgl,
countries: 'us',
marker : false,
flyTo : false,
placeholder : "Starting point",
});
const geocoderEnd = new MapboxGeocoder({
accessToken: mapboxgl.accessToken,
mapboxgl: mapboxgl,
countries: 'us',
marker : false,
flyTo : false,
placeholder : "Destination point",
});
document.getElementById('geocoderEnd').appendChild(geocoderEnd.onAdd(map));
document.getElementById('geocoderStart').appendChild(geocoderStart.onAdd(map));
