Skip to content

Commit

Permalink
More accuract height calculations for the pager collapse/expand.
Browse files Browse the repository at this point in the history
  • Loading branch information
ellisonbg committed Jul 21, 2011
1 parent 9262f15 commit e37fefa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
13 changes: 6 additions & 7 deletions IPython/frontend/html/notebook/static/js/notebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,17 @@ var IPython = (function (IPython) {
});

this.element.bind('collapse_pager', function () {
var that_height = that.element.outerHeight(true);
var pager_height = $('div#pager').outerHeight(true);
var new_height = that_height + pager_height;
console.log('collapse', that_height, pager_height, new_height);
var app_height = $('div#notebook_app').height(); // content height
var splitter_height = $('div#pager_splitter').outerHeight(true);
var new_height = app_height - splitter_height;
that.element.animate({height : new_height + 'px'}, 'fast');
});

this.element.bind('expand_pager', function () {
var that_height = that.element.outerHeight(true);
var app_height = $('div#notebook_app').height(); // content height
var splitter_height = $('div#pager_splitter').outerHeight(true);
var pager_height = $('div#pager').outerHeight(true);
var new_height = that_height - pager_height;
console.log('expand', that_height, pager_height, new_height);
var new_height = app_height - pager_height - splitter_height;
that.element.animate({height : new_height + 'px'}, 'fast');
});
};
Expand Down
10 changes: 7 additions & 3 deletions IPython/frontend/html/notebook/static/js/notebook_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@ $(document).ready(function () {
var w = win.width();
var h = win.height();
var header_height = $('div#header').outerHeight(true);
var app_height = h - header_height - 2;
var app_height = h - header_height - 2; // content height
var pager_height = $('div#pager').outerHeight(true);
var pager_splitter_height = $('div#pager_splitter').outerHeight(true);
$('div#notebook_app').height(app_height + 2);
$('div#notebook_app').height(app_height + 2); // content+padding+border height
$('div#left_panel').height(app_height);
$('div#left_panel_splitter').height(app_height);
$('div#notebook_panel').height(app_height);
$('div#notebook').height(app_height-pager_height-pager_splitter_height);
if (IPython.pager.expanded) {
$('div#notebook').height(app_height-pager_height-pager_splitter_height);
} else {
$('div#notebook').height(app_height-pager_splitter_height);
}
console.log('resize: ', app_height);
};

Expand Down

0 comments on commit e37fefa

Please sign in to comment.