diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-04-14 18:15:21 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-04-14 18:31:41 +0200 |
commit | 30498fd6f8d80d8f020eea0a4b4d6d3680457dc2 (patch) | |
tree | 80e278b6a0c0ebec7152c041e89138512ab4a576 /core | |
parent | 29bb5d27e4c2cddeb8ef07dcd28b2322743c6f6b (diff) | |
download | nextcloud-server-30498fd6f8d80d8f020eea0a4b4d6d3680457dc2.tar.gz nextcloud-server-30498fd6f8d80d8f020eea0a4b4d6d3680457dc2.zip |
Use offset function to position block elements
Diffstat (limited to 'core')
-rw-r--r-- | core/js/js.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/js/js.js b/core/js/js.js index 7e8ca6164c6..e3941fba6d5 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -297,7 +297,10 @@ function object(o) { * Fills height of window. (more precise than height: 100%;) */ function fillHeight(selector) { - var height = parseFloat($(window).height())-parseFloat(selector.css('top')); + if (selector.length == 0) { + return; + } + var height = parseFloat($(window).height())-selector.offset().top; selector.css('height', height + 'px'); if(selector.outerHeight() > selector.height()) selector.css('height', height-(selector.outerHeight()-selector.height()) + 'px'); @@ -307,8 +310,11 @@ function fillHeight(selector) { * Fills height and width of window. (more precise than height: 100%; or width: 100%;) */ function fillWindow(selector) { + if (selector.length == 0) { + return; + } fillHeight(selector); - var width = parseFloat($(window).width())-parseFloat(selector.css('left')); + var width = parseFloat($(window).width())-selector.offset().left; selector.css('width', width + 'px'); if(selector.outerWidth() > selector.width()) selector.css('width', width-(selector.outerWidth()-selector.width()) + 'px'); |