Update main.js

This commit is contained in:
Yuxin Wu 2022-05-07 15:25:23 -07:00 committed by GitHub
parent 9ca823680d
commit 81900ebaeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -45,7 +45,7 @@
function toggleFold(codeBlock, isFolded) {
const $toggle = $(codeBlock).find('.fold i');
!isFolded ? $(codeBlock).removeClass('folded').addClass('unfolded') : $(codeBlock).addClass('folded').removeClass('unfolded');
!isFolded ? $(codeBlock).removeClass('folded') : $(codeBlock).addClass('folded');
!isFolded ? $toggle.removeClass('fa-angle-right') : $toggle.removeClass('fa-angle-down');
!isFolded ? $toggle.addClass('fa-angle-down') : $toggle.addClass('fa-angle-right');
}
@ -98,6 +98,8 @@
if (fold) {
$('figure.highlight').each(function() {
$(this).addClass('foldable'); // add 'foldable' class as long as fold is enabled
if ($(this).find('figcaption').find('span').length > 0) {
const span = $(this).find('figcaption').find('span');
if (span[0].innerText.indexOf('>folded') > -1) {