IPython / Jupyter笔记本3 - 默认隐藏标题 [英] IPython/Jupyter notebook 3 - hide headers by default
问题描述
在IPython笔记本3.0版之前,默认情况下可以隐藏笔记本标题,方法是将其添加到.ipython \profile_default\static \custom\custom.js(在Windows上):
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();
});
或Jupyter,〜/ .jupyter / custom / custom.js, IPython
替换为 Jupyter
。
or for Jupyter, "~/.jupyter/custom/custom.js", with IPython
replaced by Jupyter
.
这似乎不再起作用了。它隐藏了标题,但它也在页面的顶部和底部留下了很大的空白。
我不熟悉javascript和css。有没有人找到解决方案呢?
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?
推荐答案
将此添加到个人资料中的custom.css(例如〜/ .ipython / profile_default / static / custom / custom.css for me):
add this to custom.css in your profile (e.g. ~/.ipython/profile_default/static/custom/custom.css for me):
div#site{
height: 100% !important;
}
删除底部任何讨厌的灰色空间。另外,我将此添加到我的custom.js(相同文件夹)以使用ctrl -`切换标题:
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.
这篇关于IPython / Jupyter笔记本3 - 默认隐藏标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!