summaryrefslogtreecommitdiff
path: root/resources/src/jquery/jquery.mw-jump.js
diff options
context:
space:
mode:
Diffstat (limited to 'resources/src/jquery/jquery.mw-jump.js')
-rw-r--r--resources/src/jquery/jquery.mw-jump.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/resources/src/jquery/jquery.mw-jump.js b/resources/src/jquery/jquery.mw-jump.js
new file mode 100644
index 00000000..5eae0bec
--- /dev/null
+++ b/resources/src/jquery/jquery.mw-jump.js
@@ -0,0 +1,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' } );
+ }
+ } );
+
+} );