From bfa501855aa856a49fe57fa9ccfcbe23d4cf2b56 Mon Sep 17 00:00:00 2001 From: Min RK Date: Thu, 5 Mar 2015 16:46:58 -0800 Subject: [PATCH] use $(window).height() instead of window.innerHeight to measure window height when resizing contents Sometimes these values differ by a pixel, we may never know why. window.innerHeight seems to be larger when they disagree, causing an extra scrollbar to be drawn. --- IPython/html/static/base/js/page.js | 2 +- IPython/html/static/terminal/js/main.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/IPython/html/static/base/js/page.js b/IPython/html/static/base/js/page.js index ea35027b8..1fa67274b 100644 --- a/IPython/html/static/base/js/page.js +++ b/IPython/html/static/base/js/page.js @@ -56,7 +56,7 @@ define([ Page.prototype._resize_site = function() { // Update the site's size. - $('div#site').height(window.innerHeight - $('#header').height()); + $('div#site').height($(window).height() - $('#header').height()); }; // Register self in the global namespace for convenience. diff --git a/IPython/html/static/terminal/js/main.js b/IPython/html/static/terminal/js/main.js index f76ee288d..682f34431 100644 --- a/IPython/html/static/terminal/js/main.js +++ b/IPython/html/static/terminal/js/main.js @@ -36,7 +36,7 @@ require([ var header = $("#header")[0] function calculate_size() { - var height = window.innerHeight - header.offsetHeight; + var height = $(window).height() - header.offsetHeight; var width = $('#terminado-container').width(); var rows = Math.min(1000, Math.max(20, Math.floor(height/termRowHeight())-1)); var cols = Math.min(1000, Math.max(40, Math.floor(width/termColWidth())-1)); @@ -57,7 +57,7 @@ require([ var geom = calculate_size(); terminal.term.resize(geom.cols, geom.rows); terminal.socket.send(JSON.stringify(["set_size", geom.rows, geom.cols, - window.innerHeight, window.innerWidth])); + $(window).height(), $(window).width()])); }; });