diff -r 346c88efed21 -r 5e2f62d02dcd wp/wp-content/themes/twentyfourteen/js/keyboard-image-navigation.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wp/wp-content/themes/twentyfourteen/js/keyboard-image-navigation.js Tue Jun 09 03:35:32 2015 +0200 @@ -0,0 +1,21 @@ +/** + * Twenty Fourteen keyboard support for image navigation. + */ +( function( $ ) { + $( document ).on( 'keydown.twentyfourteen', function( e ) { + var url = false; + + // Left arrow key code. + if ( e.which === 37 ) { + url = $( '.previous-image a' ).attr( 'href' ); + + // Right arrow key code. + } else if ( e.which === 39 ) { + url = $( '.entry-attachment a' ).attr( 'href' ); + } + + if ( url && ( ! $( 'textarea, input' ).is( ':focus' ) ) ) { + window.location = url; + } + } ); +} )( jQuery ); \ No newline at end of file