diff --git a/public/javascripts/stream.js b/public/javascripts/stream.js index eacccf0ea..ede3fa652 100644 --- a/public/javascripts/stream.js +++ b/public/javascripts/stream.js @@ -43,8 +43,12 @@ $(document).ready(function(){ // reshare button action $stream.delegate(".reshare_button", "click", function(evt){ evt.preventDefault(); - $(this).toggleClass("active") - .closest(".reshare_pane").children(".reshare_box").toggle(); + button = $(this) + box = button.siblings(".reshare_box"); + if(box.length > 0){ + button.toggleClass("active"); + box.toggle(); + } }); });//end document ready diff --git a/public/javascripts/view.js b/public/javascripts/view.js index d06813cc1..aa20805ba 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -64,11 +64,11 @@ $(document).ready(function(){ }); $('body').click( function(event){ - var $this = $(this); - if(!$this.closest('#user_menu').length){ + var target = $(event.target); + if(!target.closest('#user_menu').length){ $("#user_menu").removeClass("active"); }; - if(!$this.closest('.reshare_pane').length){ + if(!target.closest('.reshare_pane').length){ $(".reshare_button").removeClass("active"); $(".reshare_box").hide(); };