Fix: Back to normal state after the link being copied

This commit is contained in:
Óscar M. Lage 2024-12-05 18:36:05 +01:00
parent 1293f093d5
commit 5c42ff6851

View File

@ -1,12 +1,9 @@
// Inicializar Clipboard.js
const clipboard = new ClipboardJS(".clipboard");
// Manejar el evento de éxito
clipboard.on("success", function (e) {
const clipboardDiv = e.trigger;
// Cambiar el fondo y el color del texto
clipboardDiv.classList.remove("bg-white", "hover:bg-gray-100");
clipboardDiv.classList.remove("hover:bg-gray-100");
clipboardDiv.classList.add("bg-green-100");
// Mostrar mensaje
@ -17,6 +14,7 @@ clipboard.on("success", function (e) {
setTimeout(() => {
feedback.classList.add("hidden");
clipboardDiv.classList.remove("bg-green-100");
clipboardDiv.classList.add("hover:bg-gray-100");
}, 2000);
});