diff options
author | Andrew Dolgov <[email protected]> | 2018-12-07 10:09:37 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-12-07 10:09:37 +0300 |
commit | 7a276f9898aeaf93e6486d077e2936fd77983d39 (patch) | |
tree | f1bb2b3ceba75bacd659c28bd51eb2897d095e4e /js/Headlines.js | |
parent | c4b01dd547e16bb042bfba1df4ec716e1d2fbce3 (diff) |
updateFloatingTitle: add safety offset to hide/show because mozilla can't into math
Diffstat (limited to 'js/Headlines.js')
-rwxr-xr-x | js/Headlines.js | 14 |
1 files changed, 10 insertions, 4 deletions
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 = "<i class=\"material-icons anchor\" onclick=\"Article.cdmScrollToId(" + id + ", true)\">expand_more</i>"; + ft.select(".dijitCheckBox")[0].outerHTML = "<i class=\"material-icons icon-anchor\" onclick=\"Article.cdmScrollToId(" + id + ", true)\">expand_more</i>"; 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; } |