Before IPython notebook version 3.0 the notebook headers could be hidden by default by adding this to ".ipython\profile_default\static\custom\custom.js" (on Windows):
$([IPython.events]).on("app_initialized.NotebookApp", function () {
$('div#header').hide();
$('div#maintoolbar').hide();
});
or for Jupyter, "~/.jupyter/custom/custom.js", with IPython
replaced by Jupyter
.
also see this question
This does not seem to work anymore. It hides the headers, but it also leaves a big gap on the page's top and bottom. I am not familiar with javascript and css. Has anyone found a solution to this yet?
add this to custom.css in your profile (e.g. ~/.ipython/profile_default/static/custom/custom.css for me):
div#site{
height: 100% !important;
}
to remove any nasty grey space at the bottom. Also, I add this to my custom.js (same folder) to toggle the header using ctrl-` :
$([IPython.events]).on('notebook_loaded.Notebook', function(){
$('#header').hide();
IPython.keyboard_manager.command_shortcuts.add_shortcut('ctrl-`', function (event) {
if (IPython.notebook.mode == 'command') {
$('#header').toggle();
return false;
}
return true;
});
});
The downside is that you can accidentally scroll the header partially off the page, but that only happens if you scroll on it and it's not a big deal, especially if you want it hidden mostly anyway.
In ipython 3, #header
refers to the complete assembly at the top of the page, not just the image banner as it did in ipython 2.
To permanently hide the toolbar and header while keeping the menu, I added
$([IPython.events]).on("app_initialized.NotebookApp", function () {
$('div#header-container').hide();
$('div#maintoolbar').hide();
});
to my ~/.ipython/profile_name/static/custom/custom.js
Combining the answers by @John_C and @cknd and avoiding the `-key (which is a dead-key on my (Dutch) keyboard layout), I added this to my ~/.ipython/profile_name/static/custom/custom.js
:
$([IPython.events]).on('notebook_loaded.Notebook', function(){
$('#header').hide();
IPython.keyboard_manager.command_shortcuts.add_shortcut('ctrl-;', function (event) {
if (IPython.notebook.mode == 'command') {
$('#header').toggle();
return false;
}
return true;
});
IPython.keyboard_manager.command_shortcuts.add_shortcut('ctrl-.', function (event) {
if (IPython.notebook.mode == 'command') {
$('#header').show();
$('#header-container').toggle();
$('#maintoolbar').toggle();
return false;
}
return true;
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With