~canonical-sysadmins/wordpress/4.7.4

« back to all changes in this revision

Viewing changes to wp-content/themes/twentyfourteen/js/keyboard-image-navigation.js

  • Committer: Jacek Nykis
  • Date: 2015-01-05 16:17:05 UTC
  • Revision ID: jacek.nykis@canonical.com-20150105161705-w544l1h5mcg7u4w9
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * Twenty Fourteen keyboard support for image navigation.
 
3
 */
 
4
( function( $ ) {
 
5
        $( document ).on( 'keydown.twentyfourteen', function( e ) {
 
6
                var url = false;
 
7
 
 
8
                // Left arrow key code.
 
9
                if ( e.which === 37 ) {
 
10
                        url = $( '.previous-image a' ).attr( 'href' );
 
11
 
 
12
                // Right arrow key code.
 
13
                } else if ( e.which === 39 ) {
 
14
                        url = $( '.entry-attachment a' ).attr( 'href' );
 
15
                }
 
16
 
 
17
                if ( url && ( !$( 'textarea, input' ).is( ':focus' ) ) ) {
 
18
                        window.location = url;
 
19
                }
 
20
        } );
 
21
} )( jQuery );
 
 
b'\\ No newline at end of file'