mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-04 09:49:37 +01:00
c437b2d508
Built from https://develop.svn.wordpress.org/trunk@26332 git-svn-id: http://core.svn.wordpress.org/trunk@26234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
21 lines
496 B
JavaScript
21 lines
496 B
JavaScript
/**
|
|
* 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 ); |