diff --git a/app/assets/javascripts/votes.js.coffee b/app/assets/javascripts/votes.js.coffee index e4223c644..030b9cf46 100644 --- a/app/assets/javascripts/votes.js.coffee +++ b/app/assets/javascripts/votes.js.coffee @@ -1,20 +1,22 @@ App.Votes = hoverize: (votes) -> - $(votes).hover -> - $("div.anonymous-votes", votes).show(); - $("div.organizations-votes", votes).show(); - $("div.not-logged", votes).show(); - $("div.no-supports-allowed", votes).show(); - $("div.logged", votes).hide(); - , -> - $("div.anonymous-votes", votes).hide(); - $("div.organizations-votes", votes).hide(); - $("div.not-logged", votes).hide(); - $("div.no-supports-allowed", votes).hide(); - $("div.logged", votes).show(); + $(document).on { + 'mouseenter focus': -> + $("div.anonymous-votes", this).show(); + $("div.organizations-votes", this).show(); + $("div.not-logged", this).show(); + $("div.no-supports-allowed", this).show(); + $("div.logged", this).hide(); + mouseleave: -> + $("div.anonymous-votes", this).hide(); + $("div.organizations-votes", this).hide(); + $("div.not-logged", this).hide(); + $("div.no-supports-allowed", this).hide(); + $("div.logged", this).show(); + }, votes initialize: -> - App.Votes.hoverize votes for votes in $("div.votes") - App.Votes.hoverize votes for votes in $("div.supports") + App.Votes.hoverize "div.votes" + App.Votes.hoverize "div.supports" false