Skip to content

Instantly share code, notes, and snippets.

@zachharkey
Created December 13, 2013 21:18
Show Gist options
  • Save zachharkey/7951480 to your computer and use it in GitHub Desktop.
Save zachharkey/7951480 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
jQuery(document).ready(function($){
// Get current url
// Select an a element that has the matching href and apply a class of 'active'. Also prepend a - to the content of the link
var url = window.location.href;
$('.menu a[href="'+url+'"]').addClass('current_page_item');
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment