Skip to content

Instantly share code, notes, and snippets.

@brightrain
Last active August 29, 2015 13:58
Show Gist options
  • Save brightrain/9982555 to your computer and use it in GitHub Desktop.
Save brightrain/9982555 to your computer and use it in GitHub Desktop.
click event for toggling map layer
//click event for layers
//using dojo for the event and class toggling
//but could just as easily be jQuery or vanilla javascript
on(dojo.byId("trail"), "click", function() {
trailsLayer.visible ? trailsLayer.hide() : trailsLayer.show();
dojo.toggleClass(this, "visible");
dojo.query("#trail .visibility-icon")
.toggleClass("fa-picture-o")
.toggleClass("fa-ban");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment