diff options
Diffstat (limited to 'js/AppBase.js')
-rw-r--r-- | js/AppBase.js | 12 |
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; |