summaryrefslogtreecommitdiff
path: root/resources/src/jquery/jquery.mw-jump.js
blob: 5eae0bec8d393316f513d0dbc8c5228b8d06e9ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/**
 * JavaScript to show jump links to motor-impaired users when they are focused.
 */
jQuery( function ( $ ) {

	$( '.mw-jump' ).on( 'focus blur', 'a', function ( e ) {
		// Confusingly jQuery leaves e.type as focusout for delegated blur events
		if ( e.type === 'blur' || e.type === 'focusout' ) {
			$( this ).closest( '.mw-jump' ).css( { height: 0 } );
		} else {
			$( this ).closest( '.mw-jump' ).css( { height: 'auto' } );
		}
	} );

} );