✨ Closed #108, add animated transition when expand and collapse code block.
This commit is contained in:
parent
4ec1f8e732
commit
0b8bdc0e00
@ -37,7 +37,8 @@
|
|||||||
font-variant: normal;
|
font-variant: normal;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
text-rendering: auto;
|
text-rendering: auto;
|
||||||
padding-right: .25rem;
|
padding-right: .25rem;
|
||||||
|
transition: content 1s ease-in-out;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
content: "\f102";
|
content: "\f102";
|
||||||
@ -61,9 +62,18 @@
|
|||||||
|
|
||||||
> .chroma {
|
> .chroma {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
max-height: 500px;
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
transition: max-height 0.8s ease-in-out, opacity 0.7s ease-in-out;
|
||||||
|
|
||||||
&.hidden-code {
|
&.hidden-code {
|
||||||
display: none;
|
max-height: 0;
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
|
||||||
|
animation-name: slideInUp;
|
||||||
|
animation-duration: 1s;
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
|
@ -14,12 +14,11 @@ NexT.plugins.others.clipboard = function () {
|
|||||||
let lang = codeblock.className;
|
let lang = codeblock.className;
|
||||||
let copyBtn = document.createElement('div');
|
let copyBtn = document.createElement('div');
|
||||||
copyBtn.classList.add('copy-btn');
|
copyBtn.classList.add('copy-btn');
|
||||||
codeblock.parentNode .appendChild(copyBtn);
|
codeblock.parentNode.appendChild(copyBtn);
|
||||||
|
|
||||||
element.addEventListener('mouseleave', () => {
|
element.addEventListener('mouseleave', () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
copyBtn.classList.remove('copied');
|
copyBtn.classList.remove('copied','uncopied');
|
||||||
copyBtn.classList.remove('copieduncopied');
|
|
||||||
}, 300);
|
}, 300);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -29,8 +28,8 @@ NexT.plugins.others.clipboard = function () {
|
|||||||
ch.classList.add(lang);
|
ch.classList.add(lang);
|
||||||
ch.insertAdjacentHTML('afterbegin',
|
ch.insertAdjacentHTML('afterbegin',
|
||||||
'<span class="code-lang"></span><span class="collapse-btn"></span>');
|
'<span class="code-lang"></span><span class="collapse-btn"></span>');
|
||||||
ch.addEventListener('click', function () {
|
ch.addEventListener('click', function () {
|
||||||
element.classList.toggle('hidden-code');
|
element.classList.toggle('hidden-code');
|
||||||
ch.querySelector('.collapse-btn').classList.toggle('collapse');
|
ch.querySelector('.collapse-btn').classList.toggle('collapse');
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user