From 7a276f9898aeaf93e6486d077e2936fd77983d39 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 7 Dec 2018 10:09:37 +0300 Subject: updateFloatingTitle: add safety offset to hide/show because mozilla can't into math --- js/Headlines.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/Headlines.js b/js/Headlines.js index 17b5499c2..e0274c526 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -158,6 +158,7 @@ define(["dojo/_base/declare"], function (declare) { updateFloatingTitle: function (status_only) { if (!App.isCombinedMode()/* || !App.getInitParam("cdm_expanded")*/) return; + const safety_offset = 120; /* px, needed for firefox */ const hf = $("headlines-frame"); const elems = $$("#headlines-frame > div[id*=RROW]"); const ft = $("floatingTitle"); @@ -165,7 +166,7 @@ define(["dojo/_base/declare"], function (declare) { for (let i = 0; i < elems.length; i++) { const row = elems[i]; - if (row && row.offsetTop + row.offsetHeight > hf.scrollTop) { + if (row && row.offsetTop + row.offsetHeight > hf.scrollTop + safety_offset) { const header = row.select(".header")[0]; const id = row.getAttribute("data-article-id"); @@ -176,7 +177,7 @@ define(["dojo/_base/declare"], function (declare) { ft.setAttribute("data-article-id", id); ft.innerHTML = header.innerHTML; - ft.select(".dijitCheckBox")[0].outerHTML = "expand_more"; + ft.select(".dijitCheckBox")[0].outerHTML = "expand_more"; this.initFloatingMenu(); @@ -202,11 +203,16 @@ define(["dojo/_base/declare"], function (declare) { ft.style.marginRight = hf.offsetWidth - row.offsetWidth + "px"; - if (header.offsetTop + header.offsetHeight < hf.scrollTop + ft.offsetHeight - 5 && + /* if (header.offsetTop + header.offsetHeight < hf.scrollTop + ft.offsetHeight - 5 && row.offsetTop + row.offsetHeight >= hf.scrollTop + ft.offsetHeight - 5) Element.show(ft); else - Element.hide(ft); + Element.hide(ft); */ + + if (hf.scrollTop - row.offsetTop <= header.offsetHeight + safety_offset) + ft.fade({duration: 0.2}); + else + ft.appear({duration: 0.2}); return; } -- cgit v1.2.3