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.
17 lines
496 B
17 lines
496 B
3 years ago
|
// 代码块收缩
|
||
|
|
||
|
$(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');
|
||
|
}
|
||
|
});
|
||
|
});
|