summaryrefslogtreecommitdiff
path: root/js/AppBase.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-05-17 16:04:31 +0300
committerAndrew Dolgov <[email protected]>2020-05-17 16:04:31 +0300
commit05a84ab778ee0bc5af3ee626ef87a2074d06c51a (patch)
treef91a52fa65ae9c82096e1ef99811cb4dccfb99f7 /js/AppBase.js
parentcd1f3cb8cc5fc6e3679fb778ee23f35d179b0a1c (diff)
Headlines.move: maybe glitch less when moving back to top, etc
Diffstat (limited to 'js/AppBase.js')
-rw-r--r--js/AppBase.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/js/AppBase.js b/js/AppBase.js
index 49d276341..c4882267d 100644
--- a/js/AppBase.js
+++ b/js/AppBase.js
@@ -33,6 +33,18 @@ define(["dojo/_base/declare"], function (declare) {
elem.scrollTop += offset;
},
+ isChildVisible: function(elem, ctr) {
+ if (!elem) return;
+
+ const ctop = ctr.scrollTop;
+ const cbottom = ctop + ctr.offsetHeight;
+
+ const etop = elem.offsetTop;
+ const ebottom = etop + elem.offsetHeight;
+
+ return etop >= ctop && ebottom <= cbottom ||
+ etop < ctop && ebottom > ctop || ebottom > cbottom && etop < cbottom;
+ },
},
constructor: function() {
window.onerror = this.Error.onWindowError;