EduardET

menu hash links

Jan 19th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. <script>
  2. ( function( $ ) {
  3. $( document ).ready( function() {
  4. var menuLink = $( '#top-menu .hash-item' );
  5. menuLink.removeClass( 'current-menu-item' );
  6. menuLink.each( function() {
  7. var link = $( this ).find( 'a' );
  8. link.click( function() {
  9. menuLink.removeClass( 'current-menu-item' );
  10. $( '#top-menu .menu-item' ).removeClass( 'current-menu-item' );
  11. $( this ).parent().addClass( 'current-menu-item' );
  12. } )
  13. } )
  14. } );
  15. } )( jQuery );
  16. </script>
Advertisement
Add Comment
Please, Sign In to add comment