Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jonschr
Created September 9, 2020 20:47
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 jonschr/3de11664fc4925514d434cbd5a26865f to your computer and use it in GitHub Desktop.
Save jonschr/3de11664fc4925514d434cbd5a26865f to your computer and use it in GitHub Desktop.
jQuery(document).ready(function( $ ) {
$( window ).on( 'load', staffpageload );
$( '.stafftermlink' ).on( 'click', stafftermclick );
function stafftermclick( e ) {
e.preventDefault();
//* set the clicked link to active
$( '.stafftermlink' ).attr( 'data-status', 'inactive' );
$( this ).attr( 'data-status', 'active' );
//* hide and show
cat = $( this ).attr( 'data-term' );
$( '.entry.staff' ).hide();
$( '.' + cat ).show();
}
function staffpageload() {
//* set the first one to active
$( '.stafftermlink:first-of-type' ).attr( 'data-status', 'active' );
//* hide and show
var cat = $( '.stafftermlink:first-of-type' ).attr( 'data-term' );
$( '.entry.staff' ).hide();
$( '.' + cat ).show();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment