Skip to content

Instantly share code, notes, and snippets.

@shehabkhan013
Created August 20, 2017 08:10
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 shehabkhan013/c8e078abfebc10683b4fde4f7e692749 to your computer and use it in GitHub Desktop.
Save shehabkhan013/c8e078abfebc10683b4fde4f7e692749 to your computer and use it in GitHub Desktop.
menu active class jquery function
jQuery(window).load(function() {
var url = window.location.href;
$('#navigation li').find('.active').removeClass('active');
$('#navigation li a').filter(function(){
return this.href == url;
}).parent().addClass('active');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment