-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
68 lines (61 loc) · 2.07 KB
/
script.js
File metadata and controls
68 lines (61 loc) · 2.07 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
function showSideBar() {
const mobileBar = document.querySelector('.mobile-sidebar');
mobileBar.style.display="flex"
}
function closeSideBar() {
const mobileBar = document.querySelector('.mobile-sidebar');
mobileBar.style.display="none"
}
// redirect to login page if not logged in
const userInfo = sessionStorage.getItem("user-info");
const userName = localStorage.getItem("username");
function postSignedOut(){
var popup1 = document.querySelector('.loggedIn1');
var popup2 = document.querySelector('.loggedIn2');
const specialGreet = document.getElementById("specialGreet");
const logout = document.getElementById("logout");
logout.style.display="none";
popup1.style.display = 'flex';
popup2.style.display = 'flex';
specialGreet.style.display = 'none';
}
function signOut() {
sessionStorage.clear();
localStorage.clear();
postSignedOut();
console.log("session removed");
}
function checkIfloggedIn(){
window.location.href = "login.html";
}
// script to scroll to an exact position
function scrollToAbout(sectionId) {
var section = document.getElementById(sectionId);
if (section) {
var offsetTop = section.getBoundingClientRect().top + window.pageYOffset;
window.scrollTo({
top: offsetTop - 100, // Adjust the scroll position to add extra margin
behavior: 'smooth'
});
}
}
function scrollToStore(sectionId) {
var section = document.getElementById(sectionId);
if (section) {
var offsetTop = section.getBoundingClientRect().top + window.pageYOffset;
window.scrollTo({
top: offsetTop - 150, // Adjust the scroll position to add extra margin
behavior: 'smooth'
});
}
}
function scrollToContact(sectionId) {
var section = document.getElementById(sectionId);
if (section) {
var offsetTop = section.getBoundingClientRect().top + window.pageYOffset;
window.scrollTo({
top: offsetTop - 78, // Adjust the scroll position to add extra margin
behavior: 'smooth'
});
}
}