You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
496 B
16 lines
496 B
// 代码块收缩
|
|
|
|
$(function () {
|
|
var $code_expand = $('<i class="fas fa-angle-up code-expand" aria-hidden="true"></i>');
|
|
|
|
$('.code-area').prepend($code_expand);
|
|
$('.code-expand').on('click', function () {
|
|
if ($(this).parent().hasClass('code-closed')) {
|
|
$(this).siblings('pre').find('code').show();
|
|
$(this).parent().removeClass('code-closed');
|
|
} else {
|
|
$(this).siblings('pre').find('code').hide();
|
|
$(this).parent().addClass('code-closed');
|
|
}
|
|
});
|
|
});
|
|
|