wrappd.sh/assets/custom.js

25 lines
668 B
JavaScript
Raw Normal View History

const clipboard = new ClipboardJS(".clipboard");
clipboard.on("success", function (e) {
const clipboardDiv = e.trigger;
clipboardDiv.classList.remove("hover:bg-gray-100");
clipboardDiv.classList.add("bg-green-100");
// Mostrar mensaje
const feedback = document.getElementById("feedback");
feedback.classList.remove("hidden");
// Restaurar el color después de 2 segundos
setTimeout(() => {
feedback.classList.add("hidden");
clipboardDiv.classList.remove("bg-green-100");
clipboardDiv.classList.add("hover:bg-gray-100");
}, 2000);
});
// Manejar errores
clipboard.on("error", function (e) {
console.error("Failed to copy:", e);
});