From 5d77e37a3c21fa16b6f6ba29a789c59389d63b7d Mon Sep 17 00:00:00 2001 From: psychobunny Date: Wed, 23 Mar 2016 09:14:35 -0400 Subject: [PATCH] closes #4403 --- public/src/client/topic/postTools.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js index 101df3c646..b16a05a067 100644 --- a/public/src/client/topic/postTools.js +++ b/public/src/client/topic/postTools.js @@ -64,17 +64,21 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator }; function addVoteHandler() { - components.get('topic').on('mouseenter', '[data-pid] [component="post/vote-count"]', function() { - loadDataAndCreateTooltip($(this).parent()); - }); + components.get('topic').on('mouseenter', '[data-pid] [component="post/vote-count"]', loadDataAndCreateTooltip); } - function loadDataAndCreateTooltip(el) { - var pid = el.parents('[data-pid]').attr('data-pid'); + function loadDataAndCreateTooltip() { + var $this = $(this), + el = $this.parent(), + pid = el.parents('[data-pid]').attr('data-pid'); + + $this.off('mouseenter', loadDataAndCreateTooltip); socket.emit('posts.getUpvoters', [pid], function(err, data) { if (!err && data.length) { createTooltip(el, data[0]); } + + $this.on('mouseenter', loadDataAndCreateTooltip); }); }