diff options
author | Struan Donald <struan@exo.org.uk> | 2013-06-26 17:02:25 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2013-06-26 17:02:25 +0100 |
commit | f9d249249a567b554288ace3ebdb0e1eb9dda66a (patch) | |
tree | 5cdcdda88a470a55a8d1b18b3f49c4581adc3fd9 /www/js | |
parent | 13472b17d2f4c71e24b07d1178e1b99c3c9f9da2 (diff) |
change page height setting code so it works on all pages and update
details form height setting code to work with it
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/views/details.js | 4 | ||||
-rw-r--r-- | www/js/views/fms.js | 13 |
2 files changed, 11 insertions, 6 deletions
diff --git a/www/js/views/details.js b/www/js/views/details.js index 996ece9..5eb6b85 100644 --- a/www/js/views/details.js +++ b/www/js/views/details.js @@ -5,6 +5,7 @@ id: 'details-page', prev: 'photo', next: 'submit-start', + bottomMargin: -20, events: { 'pagehide': 'destroy', @@ -28,11 +29,12 @@ }, beforeDisplay: function() { + this.fixPageHeight(); var header = this.$("div[data-role='header']:visible"), detail = this.$('#form_detail'), top = detail.position().top, viewHeight = $(window).height(), - contentHeight = viewHeight - header.outerHeight(); + contentHeight = viewHeight - header.outerHeight() + 15; detail.height( contentHeight - top ); }, diff --git a/www/js/views/fms.js b/www/js/views/fms.js index 640d5e6..918a57c 100644 --- a/www/js/views/fms.js +++ b/www/js/views/fms.js @@ -2,6 +2,7 @@ _.extend( FMS, { FMSView: Backbone.View.extend({ tag: 'div', + bottomMargin: 20, events: { 'pagehide': 'destroy', @@ -34,11 +35,13 @@ }, fixPageHeight: function() { - var screen = $(window).height(), - header = $('[data-role=header]').height(), - footer = $('[data-role=footer]').height(), - content = screen - header - footer - 5; - $('[data-role=content]').css({'height': content }); + var header = this.$("div[data-role='header']:visible"), + content = this.$('[data-role="content"]'), + top = content.position().top, + viewHeight = $(window).height(), + contentHeight = viewHeight - header.outerHeight() - this.bottomMargin; + + content.height( contentHeight - top ); }, afterRender: function() {}, |