CoreFiles by mySites.guru
keyboard-image-navigation.js26 lines, 527 bytes, from wordpress-5.2.21.zip
Raw History Compare with 5.2.20
md5
5de7ed2727c193e9f32f5797a590889e
sha1
5647fcd47d19b4d5697b57b079499ffee8f20dd0
sha256
e98d03422b0b466cc917e578be0e7695fa738b261cae2577fc1a12991d2dfe60
/**
 * Twenty Sixteen keyboard support for image navigation.
 */

( function( $ ) {
	$( document ).on( 'keydown.twentysixteen', function( e ) {
		var url = false;

		// Left arrow key code.
		if ( 37 === e.which ) {
			url = $( '.nav-previous a' ).attr( 'href' );

		// Right arrow key code.
		} else if ( 39 === e.which ) {
			url = $( '.nav-next a' ).attr( 'href' );

		// Other key code.
		} else {
			return;
		}

		if ( url && ! $( 'textarea, input' ).is( ':focus' ) ) {
			window.location = url;
		}
	} );
} )( jQuery );

The same content is in 408 releases, WordPress 4.4-beta3 to 5.3.2. See them all, or every version of this file.