-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
29 lines (27 loc) · 845 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
28
29
$(document).ready(function () {
$("#formAddBook").submit(function (event) {
// console.log($("#newBook").val());
const inpValue = $("#newBook").val();
if (inpValue != "") {
$("#bookOptions").append(`<option value="">${inpValue}</option>`);
alert("New book has been added!");
}
$("#newBook").val("");
event.preventDefault();
});
$("#btnToggle").click(function (event) {
// console.log("hehe");
if (!$(".card").hasClass("active")) $(".card").addClass("active");
else $(".card").removeClass("active");
});
});
var typed = new Typed(".typing-text", {
strings: ["Try It!"],
typeSpeed: 180,
loop: true,
});
// efek sticky header
window.addEventListener("scroll", function () {
var header = document.querySelector("header");
header.classList.toggle("sticky", window.scrollY > 0);
});