Twenty Fourteen: fix an issue with keyboard navigation where you couldn't navigate to the previous image. Props obenland, see #25946.

git-svn-id: https://develop.svn.wordpress.org/trunk@26226 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Lance Willett 2013-11-15 21:18:00 +00:00
parent 001e4b6052
commit b52ee7959b

View File

@ -1,12 +1,16 @@
jQuery( document ).ready( function( $ ) {
$( document ).keydown( function( e ) {
jQuery( function( $ ) {
$( document ).on( 'keydown.twentyfourteen', function( e ) {
var url = false;
if ( e.which === 37 ) { // Left arrow key code
// Left arrow key code.
if ( e.which === 37 ) {
url = $( '.previous-image a' ).attr( 'href' );
}
else if ( e.which === 39 ) { // Right arrow key code
// Right arrow key code.
} else if ( e.which === 39 ) {
url = $( '.entry-attachment a' ).attr( 'href' );
}
if ( url && ( !$( 'textarea, input' ).is( ':focus' ) ) ) {
window.location = url;
}