-
Notifications
You must be signed in to change notification settings - Fork 0
/
sticky.js
26 lines (26 loc) · 907 Bytes
/
sticky.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
let sticky = document.querySelector("#sticky");
sticky.addEventListener("click", function (e) {
let sticky = document.createElement("div");
sticky.setAttribute("class", "sticky");
sticky.innerHTML = `<div class="navbar">
<div class="close"></div>
<div class="minimize"></div>
</div>
<textarea name="" class="textarea"></textarea>`;
body.appendChild(sticky);
let minimize = sticky.querySelector(".minimize");
let close = sticky.querySelector(".close");
let textArea = sticky.querySelector("textarea");
let isClosed = false;
minimize.addEventListener("click", function (e) {
if (isClosed == false) {
textArea.style.display = "none";
} else {
textArea.style.display = "block";
}
isClosed = !isClosed
})
close.addEventListener("click", function () {
sticky.remove();
})
})