diff --git a/sphinx_book_theme/static/sphinx-book-theme.js b/sphinx_book_theme/static/sphinx-book-theme.js index dfaaa63d..5c558bd6 100644 --- a/sphinx_book_theme/static/sphinx-book-theme.js +++ b/sphinx_book_theme/static/sphinx-book-theme.js @@ -30,5 +30,16 @@ var sbRunWhenDOMLoaded = cb => { } } +// Toggle full-screen with button +function toggleFullScreen() { + if (!document.fullscreenElement) { + document.documentElement.requestFullscreen(); + } else { + if (document.exitFullscreen) { + document.exitFullscreen(); + } + } +} + sbRunWhenDOMLoaded(initTriggerNavBar) sbRunWhenDOMLoaded(scrollToActive) diff --git a/sphinx_book_theme/topbar.html b/sphinx_book_theme/topbar.html index 1f3fe7e9..1617b104 100644 --- a/sphinx_book_theme/topbar.html +++ b/sphinx_book_theme/topbar.html @@ -26,6 +26,9 @@ {% if theme_use_edit_page_button and github_repo %}{% endif %} + + + {% if binder_url or jupyterhub_url or use_thebelab %}