ie.geologyidea.com
More

Using Navbar Dropdown Button Checkbox in Mapbox?

Using Navbar Dropdown Button Checkbox in Mapbox?


We are searching data for your request:

Forums and discussions:
Manuals and reference books:
Data from registers:
Wait the end of the search in all databases.
Upon completion, a link will appear to access the found materials.


I am creating a map application in theBootstrapframework. I have a drop-down with 3 buttons to toggle layers on and off. I am using aglyphiconas the checkbox with text to the side. If you click the checkbox, the layer switches as expected. However, if you click on the text it changes the checkbox, but does not control the layer toggle. I have tried wrapping the label with aspanbut this did not work.

Any suggestions?

HTML:

BASEMAP  

JavaScript:

$("#mapLabel").click(function(event) { console.log("Click"); layerClicked = window[event.target.value]; if (map.hasLayer(layerClicked)) { map.removeLayer(layerClicked); } else{ map.addLayer(layerClicked); } ; });

Try this jquery method: http://api.jquery.com/find/

$(".your-span-class").find("#mapLabel").click(function(event) {…

I think the issue is your either selecting a parent element or a child element, which will be easier debugging in a web browser inspector. I don't believe Bootstrap is your issue.

On a separate/quasi-related note, I've found that the Semantic-UI Framework documentation a bit more helpful than Bootstraps with implementing such functionality. And, it works with jQuery. I really don't use Bootstrap anymore, and would recommend Semantic-UI as an alternative to anyone.



Comments:

  1. Mardon

    exactly on target :)

  2. Andsaca

    Agreed, the remarkable thought

  3. Iobates

    Don't be cheated on this account.

  4. Montgomery

    full of FOOFOL !!!

  5. Boulad

    wonderfully, very valuable answer



Write a message