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

Built from https://develop.svn.wordpress.org/trunk@26226


git-svn-id: http://core.svn.wordpress.org/trunk@26133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2013-11-15 21:18:09 +00:00
parent a52f3ebb7b
commit 433c648e1d
1 changed files with 9 additions and 5 deletions

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;
}