From 6e7bdf7cad1f15665cd4e61510e62e6d21cda5b8 Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Mon, 7 Mar 2011 10:32:31 -0800 Subject: [PATCH] don't change photos while commenting --- public/javascripts/photo-show.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/public/javascripts/photo-show.js b/public/javascripts/photo-show.js index d563b9296..5f940c6be 100644 --- a/public/javascripts/photo-show.js +++ b/public/javascripts/photo-show.js @@ -53,16 +53,18 @@ $(document).ready(function() { // right/left hotkeys $(document).keyup(function(e){ - //left - if(e.keyCode == 37) { - if( $("#photo_show_left").length > 0 ){ - document.location = $("#photo_show_left").attr('href'); - } + if(!$(e.target).hasClass('comment_box')){ + //left + if(e.keyCode == 37) { + if( $("#photo_show_left").length > 0 ){ + document.location = $("#photo_show_left").attr('href'); + } - //right - } else if(e.keyCode == 39) { - if( $("#photo_show_right").length > 0 ){ - document.location = $("#photo_show_right").attr('href'); + //right + } else if(e.keyCode == 39) { + if( $("#photo_show_right").length > 0 ){ + document.location = $("#photo_show_right").attr('href'); + } } } });