Make WordPress Core

Changeset 26226


Ignore:
Timestamp:
11/15/2013 09:18:00 PM (11 years ago)
Author:
lancewillett
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfourteen/js/keyboard-image-navigation.js

    r25995 r26226  
    1 jQuery( document ).ready( function( $ ) {
    2     $( document ).keydown( function( e ) {
     1jQuery( function( $ ) {
     2    $( document ).on( 'keydown.twentyfourteen', function( e ) {
    33        var url = false;
    4         if ( e.which === 37 ) {  // Left arrow key code
     4
     5        // Left arrow key code.
     6        if ( e.which === 37 ) {
    57            url = $( '.previous-image a' ).attr( 'href' );
    6         }
    7         else if ( e.which === 39 ) {  // Right arrow key code
     8
     9        // Right arrow key code.
     10        } else if ( e.which === 39 ) {
    811            url = $( '.entry-attachment a' ).attr( 'href' );
    912        }
     13
    1014        if ( url && ( !$( 'textarea, input' ).is( ':focus' ) ) ) {
    1115            window.location = url;
Note: See TracChangeset for help on using the changeset viewer.