-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
50 lines (44 loc) · 1.23 KB
/
script.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
window.addEventListener("load", () => {
const card = document.getElementById("card");
gsap.to(card, {
duration: 2,
rotationY: 0,
ease: "elastic.out(1, 0.5)",
});
const music = document.getElementById("music");
const musicButton = document.getElementById("musicButton");
music.volume = 0.5;
let isPlaying = false;
musicButton.addEventListener("click", () => {
if (!isPlaying) {
music.play();
musicButton.textContent = "⏸ Pausar Música";
isPlaying = true;
} else {
music.pause();
musicButton.textContent = "▶ Música Navideña";
isPlaying = false;
}
});
});
window.addEventListener("load", () => {
const card = document.getElementById("card");
const printButton = document.getElementById("printButton");
printButton.addEventListener("click", () => {
const printContent = card.outerHTML;
const printWindow = window.open("", "_blank");
printWindow.document.write(`
<html>
<head>
<title>Imprimir Tarjeta</title>
<link rel="stylesheet" href="./styles.css">
</head>
<body>
${printContent}
</body>
</html>
`);
printWindow.document.close();
printWindow.print();
});
});