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