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
#photo_controls
.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
=link_to "← #{t('.view_original_post')}", @photo.status_message

View file

@ -23,7 +23,7 @@ $(document).ready( function(){
$("#show_photo").find("img").fadeTo(200,1);
$("#photo_spinner").hide();
});
$('.edit_photo').bind('ajax:success', function(data, json, xhr) {
json = $.parseJSON(json);
$(".edit_photo input[type='text']").val(json['photo']['caption']);
@ -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
.from
:margin
:bottom 5px
h4
:display inline
a