-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
35 lines (26 loc) · 1.14 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
const im = document.querySelector(".poimg");
const heart = document.getElementById("heart")
im.addEventListener("dblclick", () => {
console.log("hi")
heart.classList.replace("far", "fas");
heart.style.color = "red";
document.getElementById("pa").innerHTML = "Liked by You and 164 Others";
im.classList.add('active');
setInterval(() => {
im.classList.remove('active');
}, 2000);
})
heart.addEventListener("click", hearthandle);
function hearthandle() {
var att = heart.getAttributeNode("class").value
if (att == 'far fa-heart') {
heart.classList.replace("far", "fas");
heart.style.color = "red";
document.getElementById("pa").innerHTML = "Liked by You and 164 Others";
}
else if (att == 'fas fa-heart') {
heart.classList.replace("fas", "far");
heart.style.color = "white";
document.getElementById("pa").innerHTML = "Liked by sn_gujjar and 163 Others";
}
}