From a09834db6a0eec05e5742ca33acc68a3babd3fc3 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Thu, 16 Aug 2018 16:10:19 +0200 Subject: [PATCH] testing, made new popover designs --- .../javascripts/sitewide/popover_helper.js | 57 ++++++++++--------- app/views/shared/_navigation.html.erb | 12 ++++ 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/app/assets/javascripts/sitewide/popover_helper.js b/app/assets/javascripts/sitewide/popover_helper.js index c5aca2631..1a92ab29d 100644 --- a/app/assets/javascripts/sitewide/popover_helper.js +++ b/app/assets/javascripts/sitewide/popover_helper.js @@ -2,32 +2,37 @@ 'use strict'; $(document).ready(function() { - $('.popover_v2').popover({ - html: true, - container: 'body', - placement: 'auto right', - trigger: 'manual', - template: '' - }).on("mouseenter", function () { - setTimeout(function () { - $('.popover_v2').popover("show") - var top = $('.popover_v2').offset().top; - $('.popover_v2_window').css({ - top: (top) + 'px' - }); - $(".popover_v2_window").on("mouseleave", function () { - $('.popover_v2').popover('hide'); - }); - }, 1000); - }).on("mouseleave", function () { - setTimeout(function () { - if (!$(".popover_v2_window:hover").length) { - $('.popover_v2').popover("hide") + $('.popover_v2').each(function(i,obj) { + + $(obj).popover({ + html: true, + container: 'body', + placement: 'auto right', + trigger: 'manual', + template: '' + }).on("mouseenter", function () { + setTimeout(function () { + if ($(obj).hover().length) { + $(obj).popover("show") + var top = $(obj).offset().top; + $('body').find('.popover_'+i+'_window').css({ + top: (top) + 'px' + }); + $('body').find(".popover_"+i+"_window").on("mouseleave", function () { + $(obj).popover('hide'); + }); } - }, 500); - }); + }, 1000); + }).on("mouseleave", function () { + setTimeout(function () { + if (!$('body').find(".popover_"+i+"_window:hover").length) { + $(obj).popover("hide") + } + }, 500); + }); + }) }); }()); diff --git a/app/views/shared/_navigation.html.erb b/app/views/shared/_navigation.html.erb index ceb3381f4..6575dfab8 100644 --- a/app/views/shared/_navigation.html.erb +++ b/app/views/shared/_navigation.html.erb @@ -70,6 +70,18 @@