Skip to content

Instantly share code, notes, and snippets.

@achmiral
Forked from SunDi3yansyah/manu-active-with.js
Created November 10, 2018 06:02
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 achmiral/a68053ca4d713ffe890276034381750a to your computer and use it in GitHub Desktop.
Save achmiral/a68053ca4d713ffe890276034381750a to your computer and use it in GitHub Desktop.
Menu Active with JS
var url = window.location;
var element = $(".ui.vertical.menu a.item").filter(function() {
return this.href == url || url.href.indexOf(this.href) == 0;
}).addClass("active").parent().parent().parent();
if (element.is("li")) {
element.addClass("active");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment