You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2016/05/17 07:32:29 UTC

[whimsy] branch master updated: make header and footer scroll on short windows

This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  88712d8   make header and footer scroll on short windows
88712d8 is described below

commit 88712d8b69ed19b3d94fcf4fa20e91b44fdeff6a
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Tue May 17 03:31:49 2016 -0400

    make header and footer scroll on short windows
---
 www/board/agenda/views/layout/main.js.rb | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/www/board/agenda/views/layout/main.js.rb b/www/board/agenda/views/layout/main.js.rb
index 7188a2d..4a993fe 100644
--- a/www/board/agenda/views/layout/main.js.rb
+++ b/www/board/agenda/views/layout/main.js.rb
@@ -110,8 +110,20 @@ class Main < React
     # avoid overlapping the header and footer areas
     def window.onresize()
       main = ~'main'
-      main.style.marginTop = "#{~'header.navbar'.clientHeight}px"
-      main.style.marginBottom = "#{~'footer.navbar'.clientHeight}px"
+      if 
+        window.innerHeight <= 400 and 
+        document.body.scrollHeight > window.innerHeight
+      then
+        document.querySelector('footer').style.position = 'relative'
+        document.querySelector('header').style.position = 'relative'
+        main.style.marginTop = 0
+        main.style.marginBottom = 0
+      else
+        document.querySelector('footer').style.position = 'fixed'
+        document.querySelector('header').style.position = 'fixed'
+        main.style.marginTop = "#{~'header.navbar'.clientHeight}px"
+        main.style.marginBottom = "#{~'footer.navbar'.clientHeight}px"
+      end
 
       if Main.scrollTo == 0 or Main.scrollTo
         if Main.scrollTo == -1

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].