Advertisement
rodro1

add active class javascript

Nov 19th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. $(function(){
  2. var current = location.pathname;
  3. $('#admin-nav li a').each(function(){
  4. var $this = $(this);
  5. // if the current path is like this link, make it active
  6. if($this.attr('href').indexOf(current) !== -1){
  7. $this.parent('li').addClass('active');
  8. }
  9. })
  10. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement