-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
27 lines (23 loc) · 929 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$(document).ready(function () {
// Function to add bounce-effect class
function addBounceEffect() {
$(".copied").addClass("bounce-effect");
}
// Function to remove bounce-effect class
function removeBounceEffect() {
$(".copied").removeClass("bounce-effect");
}
// Click event handler for .copy-btn
$(".copy-btn").click(function () {
$('#textField').select(); // Select the text inside #textField
document.execCommand("copy"); // Copy the selected text to clipboard
// Show "Copied!" message
$(".copied").text("Copied!");
// Add bounce-effect class and remove after animation
addBounceEffect();
setTimeout(function () {
removeBounceEffect();
$(".copied").text(""); // Clear the text after animation
}, 800); // Adjust timing as needed
});
});