1
0
mirror of https://github.com/nostalgic-css/NES.css.git synced 2025-08-24 14:52:54 +02:00

docs: fix copied balloon

This commit is contained in:
BcRikko
2019-02-21 18:37:24 +09:00
parent bd17c12cac
commit 2685582a90
3 changed files with 38 additions and 5 deletions

View File

@@ -208,6 +208,11 @@ new Vue({
contributors,
articles,
animateOctocat: false,
copiedBalloon: {
display: 'none',
top: 0,
left: 0,
},
};
},
filters: {
@@ -221,7 +226,9 @@ new Vue({
hljs.initHighlightingOnLoad();
},
methods: {
copy(id) {
copy(event, id) {
this.showCopiedBalloon(event.pageY, event.pageX);
const fake = document.createElement('textarea');
fake.value = this.collection.find(a => a.title === id).code;
fake.setAttribute('readonly', '');
@@ -240,5 +247,15 @@ new Vue({
stopAnimate() {
this.animateOctocat = false;
},
showCopiedBalloon(top, left) {
this.copiedBalloon = {
display: 'block',
top: `${top - 100}px`,
left: `${left - 180}px`,
};
setTimeout(() => {
this.copiedBalloon.display = 'none';
}, 1000);
},
},
});