-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
40 lines (33 loc) · 1.27 KB
/
Copy pathscript.js
File metadata and controls
40 lines (33 loc) · 1.27 KB
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
function addRecommendation() {
// Get the message of the new recommendation
let recommendation = document.getElementById("new_recommendation");
// If the user has left a recommendation, display a pop-up
if (recommendation.value != null && recommendation.value.trim() != "") {
console.log("New recommendation added");
// Create a new 'recommendation' element and set its value to the user's message
var element = document.createElement("div");
element.setAttribute("class", "recommendation");
element.innerHTML = "<span>“</span>" + recommendation.value + "<span>”</span>";
// Add this element to the end of the list of recommendations
document.getElementById("all_recommendations").appendChild(element);
// Reset the value of the textarea
recommendation.value = "";
// ✅ Call showPopup here
showPopup(true);
}
}
function showPopup(bool) {
if (bool) {
document.getElementById('popup').style.visibility = 'visible'
} else {
document.getElementById('popup').style.visibility = 'hidden'
}
}
window.addEventListener("scroll", function () {
const navbar = document.getElementById("home");
if (window.scrollY > 50) {
navbar.classList.add("scrolled");
} else {
navbar.classList.remove("scrolled");
}
});