Created
September 9, 2020 20:47
-
-
Save jonschr/3de11664fc4925514d434cbd5a26865f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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