From a8068c083ffc01369401062597210dfca80ca8e9 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 21 Jan 2014 10:20:08 +0100 Subject: [PATCH] Fix #1384. --- src/General/Header.coffee | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 7399ca4c1..41438fa25 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -279,9 +279,21 @@ Header = scrollTo: (root, down, needed) -> if down x = Header.getBottomOf root + if Conf['Header auto-hide on scroll'] and Conf['Bottom header'] + {height} = Header.bar.getBoundingClientRect() + if x <= 0 + x += height if !Header.isHidden() + else + x -= height if Header.isHidden() window.scrollBy 0, -x unless needed and x >= 0 else x = Header.getTopOf root + if Conf['Header auto-hide on scroll'] and !Conf['Bottom header'] + {height} = Header.bar.getBoundingClientRect() + if x >= 0 + x += height if !Header.isHidden() + else + x -= height if Header.isHidden() window.scrollBy 0, x unless needed and x >= 0 scrollToIfNeeded: (root, down) -> Header.scrollTo root, down, true @@ -298,6 +310,12 @@ Header = headRect = Header.toggle.getBoundingClientRect() bottom -= clientHeight - headRect.bottom + headRect.height bottom + isHidden: -> + {top} = Header.bar.getBoundingClientRect() + if Conf['Bottom header'] + top is doc.clientHeight + else + top < 0 addShortcut: (el, index) -> shortcut = $.el 'span',