From 120ebc8f131facd4a191aa2df281fdd131f7a89f Mon Sep 17 00:00:00 2001 From: Shubham Dhama Date: Sun, 18 Mar 2018 00:05:19 +0530 Subject: [PATCH] hotspots: Move the code for closing hotspot icon to hotspots.js. --- static/js/click_handlers.js | 7 +------ static/js/hotspots.js | 9 +++++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js index 0cbb419569..5f38887c91 100644 --- a/static/js/click_handlers.js +++ b/static/js/click_handlers.js @@ -646,12 +646,7 @@ $(function () { // open $('body').on('click', '.hotspot-icon', function (e) { // hide icon - $(this).animate({ opacity: 0 }, { - duration: 300, - done: function () { - $(this).css({ display: 'none' }); - }.bind(this), - }); + hotspots.close_hotspot_icon(this); // show popover var hotspot_name = $(e.target).closest('.hotspot-icon') diff --git a/static/js/hotspots.js b/static/js/hotspots.js index c7f6a743a6..e4654477d0 100644 --- a/static/js/hotspots.js +++ b/static/js/hotspots.js @@ -207,6 +207,15 @@ exports.is_open = function () { return $('.hotspot.overlay').hasClass('show'); }; +exports.close_hotspot_icon = function (elem) { + $(elem).animate({ opacity: 0 }, { + duration: 300, + done: function () { + $(elem).css({ display: 'none' }); + }.bind(elem), + }); +}; + exports.load_new = function (new_hotspots) { new_hotspots.forEach(function (hotspot) { hotspot.location = HOTSPOT_LOCATIONS[hotspot.name];