CoreFiles by mySites.guru
keyboard-image-navigation.js22 lines, 486 bytes, from wordpress-4.1-beta1.zip
Raw History Compare with 4.0-beta4
md5
5efd02901c71ef9fddb3cce683c2e151
sha1
91c48240be2e5a47c4097c65c8cb2208943bead5
sha256
849d2f625c1164249eee4125b9e13148f4421f3385eae40b6ab33911e7c6c2a2
/**
 * 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 2 releases, WordPress 4.1-beta1 to 4.1-beta2. See them all, or every version of this file.