From a3e8ced6a1bb0f244c86440cbf9c5ca5a121996c Mon Sep 17 00:00:00 2001 From: Maxwell Salzberg Date: Thu, 16 Feb 2012 00:00:55 -0800 Subject: [PATCH] haha more arrow controlz --- app/views/posts/show.html.haml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/app/views/posts/show.html.haml b/app/views/posts/show.html.haml index 41fb3e3aa..b812d187b 100644 --- a/app/views/posts/show.html.haml +++ b/app/views/posts/show.html.haml @@ -11,10 +11,25 @@ :javascript $(function(){ $(document).keypress(function(event){ + console.log(event.which); $('#text').focus(); $('#comment').modal(); $('#text').focus(); }); + + $(document).keydown(function(e){ + console.log(e.keyCode); + if (e.keyCode == 37) { + + window.location = $('#back').attr('href'); + + }else if(e.keyCode == 39) { + + window.location = $('#forward').attr('href'); + + }else{} + + }); }); #post-author-header @@ -23,8 +38,8 @@ #post-content -= link_to image_tag('arrow-left.png'), post_path(@post.id-1), :class => 'nav-arrow left' -= link_to image_tag('arrow-right.png'), post_path(@post.id+1), :class => 'nav-arrow right' += link_to image_tag('arrow-left.png'), post_path(@post.id-1), :class => 'nav-arrow left', :id => 'back' += link_to image_tag('arrow-right.png'), post_path(@post.id+1), :class => 'nav-arrow right', :id => 'forward' #comment.modal.fade .modal-body