From 9fd02e71c9aeabb66874bb4151abd91134d4ce12 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Thu, 16 Aug 2018 13:04:42 +0200 Subject: [PATCH] initial popover/tooltip config --- .../javascripts/sitewide/popover_helper.js | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 app/assets/javascripts/sitewide/popover_helper.js diff --git a/app/assets/javascripts/sitewide/popover_helper.js b/app/assets/javascripts/sitewide/popover_helper.js new file mode 100644 index 000000000..f8e711434 --- /dev/null +++ b/app/assets/javascripts/sitewide/popover_helper.js @@ -0,0 +1,29 @@ +(function() { + 'use strict'; + + $(document).ready(function() { + var hover_timer + var text_to_display = $('.popover_v2').data('content') + $('.popover_v2').popover({ + html: true, + container: 'body', + placement: 'auto right', + trigger: 'manual', + template: '', + }).on("mouseenter", function () { + hover_timer = setTimeout(function () { + $('.popover_v2').popover("show") + }, 1000); + $('body').find(".popover").on("mouseleave", function () { + $('.popover_v2').popover('hide'); + }); + }).on("mouseleave", function () { + clearTimeout(hover_timer) + setTimeout(function () { + if (!$(".popover:hover").length) { + $('.popover_v2').popover("hide") + } + }, 500); + }); + }); +}());