So, first I started with this map: https://codepen.io/melissad34/pen/mNGjKR

It works exactly the way I want it to work.

Then I added a collapsible sidebar: https://codepen.io/melissad34/pen/LYYrLKN

And now the trails features aren't clickable as they were on the first version. I had to change the z-index of the divs to get the sidebar to show over the map div, so I wonder if that's why, but I assume that shouldn't be an issue because it's not like the sidebar covers the entire map.

What is causing this?

1 Answer 1


That's not an issue about mapbox at all. It's caused by script error. As console shows, the line number 31 of JS, it uses legend but it's not declared. You should set legend as ID on div element.

<div class="row row-offcanvas" id="legend">
  <div class="sidebar-offcanvas sidebar">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.