Skip to content

Commit

Permalink
fix copy to clipboard infinitely
Browse files Browse the repository at this point in the history
  • Loading branch information
lilpacy committed Nov 15, 2024
1 parent a5df098 commit 7562bca
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,16 +298,17 @@ class ColorVisualizerApp {
colorDisplay.style.height = '100px';

// コピーボタンのイベントリスナーを設定
document.getElementById('copy-color-btn').addEventListener('click', () => {
navigator.clipboard.writeText(rgbValue)
.then(() => {
alert('色コードをクリップボードにコピーしました!');
})
.catch(err => {
console.error('クリップボードへのコピーに失敗しました:', err);
alert('コピーに失敗しました。');
});
});
const copyButton = document.getElementById('copy-color-btn');
copyButton.onclick = () => {
navigator.clipboard.writeText(rgbValue)
.then(() => {
alert('Color code copied to clipboard!');
})
.catch(err => {
console.error('Failed to copy to clipboard:', err);
alert('Copy failed.');
});
};
}

animate() {
Expand Down

0 comments on commit 7562bca

Please sign in to comment.