right/left arrow keys functional on photo#show

This commit is contained in:
danielvincent 2010-12-25 19:14:24 -05:00
parent 30dd11b9fa
commit 0fb102a2ec
3 changed files with 16 additions and 5 deletions

View file

@ -8,9 +8,9 @@
.span-15.append-1.last .span-15.append-1.last
#photo_controls #photo_controls
.right .right
=link_to "← #{t('previous')}", @prev_photo, :rel => 'prefetch' =link_to "← #{t('previous')}", @prev_photo, :rel => 'prefetch', :id => 'photo_show_left'
\/ \/
=link_to "#{t('next')} →", @next_photo, :rel => 'prefetch' =link_to "#{t('next')} →", @next_photo, :rel => 'prefetch', :id => 'photo_show_right'
- if @photo.status_message_id - if @photo.status_message_id
=link_to "← #{t('.view_original_post')}", @photo.status_message =link_to "← #{t('.view_original_post')}", @photo.status_message

View file

@ -58,4 +58,17 @@ $(document).ready( function(){
}); });
}); });
// right/left hotkeys
$(document).keyup(function(e){
//left
if(e.keyCode == 37) {
document.location = $("#photo_show_left").attr('href');
//right
} else if(e.keyCode == 39) {
document.location = $("#photo_show_right").attr('href');
}
});
}); });

View file

@ -302,8 +302,6 @@ li.message
:color #777 :color #777
.from .from
:margin
:bottom 5px
h4 h4
:display inline :display inline
a a