add close button when sidebar showed in mobile screen

This commit is contained in:
geekplux 2016-06-09 02:06:51 +08:00
parent 051840df3c
commit 00ca185f8d
2 changed files with 11 additions and 1 deletions

View File

@ -1045,7 +1045,8 @@ h2.footnotes{
/******** responsive for sidebar *******/
#toggle-sidebar {
#toggle-sidebar,
#table-of-contents .close-sidebar {
display: none;
}
@ -1078,6 +1079,10 @@ h2.footnotes{
margin: 0;
padding: 0;
}
#table-of-contents .close-sidebar {
display: block;
}
}
/******** End responsive for sidebar *******/

View File

@ -49,6 +49,11 @@ $( document ).ready(function() {
var toggleSidebar = $('<div id="toggle-sidebar"><a href="#table-of-contents"><h2>Table of Contents</h2></a></div>');
$('#content').prepend(toggleSidebar);
// add close button when sidebar showed in mobile screen
var closeBtn = $('<a class="close-sidebar" href="#">Close</a>');
var tocTitle = $('#table-of-contents').find('h2');
tocTitle.append(closeBtn);
});
window.SphinxRtdTheme = (function (jquery) {