first commit
This commit is contained in:
21
wp-content/themes/solarify/js/keyboard-image-navigation.js
Normal file
21
wp-content/themes/solarify/js/keyboard-image-navigation.js
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* keyboard support for image navigation.
|
||||
*/
|
||||
( function( $ ) {
|
||||
$( document ).on( 'keydown.fw_theme', 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 );
|
||||
Reference in New Issue
Block a user