Skip to content

Commit

Permalink
Merge pull request #77 from choldgraf/fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
choldgraf authored Apr 28, 2020
2 parents a5df5a9 + eceed80 commit 20ac2b2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sphinx_book_theme/static/sphinx-book-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 3 additions & 0 deletions sphinx_book_theme/topbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<!-- Edit this page -->
{% if theme_use_edit_page_button and github_repo %}<a class="edit-button" href="{{ get_edit_url() }}"><button type="button" class="btn btn-secondary topbarbtn" title="Edit this page"><i class="fas fa-pencil-alt"></i></button></a>{% endif %}

<!-- Full screen -->
<button type="button" class="btn btn-secondary topbarbtn" onclick="toggleFullScreen()" title="Fullscreen mode"><i class="fas fa-expand"></i></button>

<!-- Launch buttons -->
{% if binder_url or jupyterhub_url or use_thebelab %}
<div class="dropdown-buttons-trigger">
Expand Down

0 comments on commit 20ac2b2

Please sign in to comment.