Skip to content

Instantly share code, notes, and snippets.

@miklb
Created September 19, 2018 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miklb/05f4bc5af283a064434d078f91e8178b to your computer and use it in GitHub Desktop.
Save miklb/05f4bc5af283a064434d078f91e8178b to your computer and use it in GitHub Desktop.
$('.menu-ui a').on('click', function() {
// For each filter link, get the 'data-filter' attribute value.
var filter = $(this).data('filter');
$(this).addClass('active').siblings().removeClass('active');
markers.setFilter(function(f) {
// If the data-filter attribute is set to "all", return
// all (true). Otherwise, filter on markers that have
// a value set to true based on the filter name.
return (filter === 'all') ? true : f.properties[filter] === true;
});
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment