_s: A better name for the image navigation script and better experience by cycling through a gallery when done
git-svn-id: https://wpcom-themes.svn.automattic.com/_s/@8849 d957f892-c61d-0410-b221-f235e6eecf30
This commit is contained in:
parent
5f2d6758e7
commit
e8b2bb81c6
2 changed files with 2 additions and 2 deletions
14
js/keyboard-image-navigation.js
Normal file
14
js/keyboard-image-navigation.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
jQuery( document ).ready( function( $ ) {
|
||||
$( document ).keydown( function( e ) {
|
||||
var url = false;
|
||||
if ( e.which == 37 ) { // Left arrow key code
|
||||
url = $( '.previous-image a' ).attr( 'href' );
|
||||
}
|
||||
else if ( e.which == 39 ) { // Right arrow key code
|
||||
url = $( '.entry-attachment a' ).attr( 'href' );
|
||||
}
|
||||
if ( url && ( !$( 'textarea, input' ).is( ':focus' ) ) ) {
|
||||
window.location = url;
|
||||
}
|
||||
} );
|
||||
} );
|
Loading…
Add table
Add a link
Reference in a new issue