CoreFiles by mySites.guru
keyboard-image-navigation.js22 lines, 487 bytes, from wordpress-4.3.21.zip
Raw History Compare with 4.3.20
md5
b82f191be2383003721f8b0d6fbaaea9
sha1
7102ceaf12a2a93d5fb590955aa3dc2b1d00a127
sha256
25a8853aadee9d2b53a2ba8ba93a965407cdb18e34bdcd21353983ffc2172ad2
/**
 * Twenty Fifteen keyboard support for image navigation.
 */

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

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

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

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

The same content is in 417 releases, WordPress 4.1-RC1 to 5.0-beta4. See them all, or every version of this file.