mirror of
https://github.com/86Box/docs.git
synced 2026-02-28 01:44:23 -07:00
Hide API code examples using expand containers by default
This commit is contained in:
@@ -54,3 +54,28 @@ div.bit-table > div.wy-table-responsive > table > thead > tr > th:not(.stub), di
|
||||
min-width: 26px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Toggle containers. */
|
||||
.toggle {
|
||||
background: #f3f6f6;
|
||||
border: 1px solid #e1e4e5;
|
||||
padding: 1em;
|
||||
margin: 0 0 24px;
|
||||
}
|
||||
.toggle-closed > .toggle-header, .toggle-open > .toggle-header {
|
||||
cursor: pointer;
|
||||
}
|
||||
.toggle > .toggle-header > p {
|
||||
font-weight: bold;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.toggle > div:nth-child(2) {
|
||||
margin-top: 12px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.toggle-closed > .toggle-header > p:before {
|
||||
content: "\0025B6 ";
|
||||
}
|
||||
.toggle-open > .toggle-header > p:before {
|
||||
content: "\0025BC ";
|
||||
}
|
||||
|
||||
25
_static/js/86box.js
Normal file
25
_static/js/86box.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/* Toggle containers, modified from: https://stackoverflow.com/questions/2454577/sphinx-restructuredtext-show-hide-code-snippets */
|
||||
$(document).ready(function() {
|
||||
/* Hide all toggle containers. */
|
||||
$('.toggle').children().not('.toggle-header').hide();
|
||||
$('.toggle').toggleClass('toggle-closed');
|
||||
|
||||
/* Add click handlers for the header. */
|
||||
$('.toggle-header').click(function() {
|
||||
/* Toggle the container. */
|
||||
$(this).parent().children().not('.toggle-header').toggle(400);
|
||||
$(this).parent().toggleClass('toggle-open toggle-closed');
|
||||
});
|
||||
|
||||
/* Fix scroll position if a heading is provided in the URL.
|
||||
Actually hit or miss but I can't think of a better solution. */
|
||||
if ($('.toggle').length && document.location.hash) {
|
||||
$(window).on('load', function() {
|
||||
setTimeout(function() {
|
||||
var hash = document.location.hash;
|
||||
document.location.hash = hash + '_';
|
||||
document.location.hash = hash;
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user