mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
Fix to implement toggle of TOC in HTML template
This commit is contained in:
parent
e32dd547b4
commit
be99350655
1 changed files with 23 additions and 0 deletions
|
@ -160,6 +160,29 @@
|
|||
removeHash();
|
||||
});
|
||||
|
||||
var toggle = $('.expand-toggle');
|
||||
var tocExpand = false;
|
||||
|
||||
checkExpandToggle();
|
||||
toggle.click(function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
tocExpand = !tocExpand;
|
||||
checkExpandToggle();
|
||||
})
|
||||
|
||||
function checkExpandToggle () {
|
||||
var toc = $('.ui-toc-dropdown .toc');
|
||||
var toggle = $('.expand-toggle');
|
||||
if (!tocExpand) {
|
||||
toc.removeClass('expand');
|
||||
toggle.text('Expand all');
|
||||
} else {
|
||||
toc.addClass('expand');
|
||||
toggle.text('Collapse all');
|
||||
}
|
||||
}
|
||||
|
||||
function scrollToTop() {
|
||||
$('body, html').stop(true, true).animate({
|
||||
scrollTop: 0
|
||||
|
|
Loading…
Reference in a new issue