EduardET

Remove menu classes for inpage menu

Dec 6th, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. ( function( $ ) {
  3.     $( document ).ready( function() {
  4.         var menuItem = $( "#top-menu li" );
  5.         menuItem.each( function() {
  6.             var menuItemLink = $(this).find("a");
  7.             $( this ).removeClass( "current-menu-item" ).removeClass( "current_page_item" );
  8.             menuItemLink.click( function() {
  9.                 $("#menu-item-205").removeClass("current-menu-ancestor");
  10.                 $( "#top-menu li" ).removeClass( "current-menu-item" ).removeClass( "current_page_item" );
  11.                 $( this ).parent().addClass( "current-menu-item" ).addClass( "current_page_item" );
  12.             } )
  13.         } )
  14.     } );
  15. } )( jQuery );
  16. </script>
Advertisement
Add Comment
Please, Sign In to add comment