-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
199 lines (160 loc) · 7.22 KB
/
app.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
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
// Lets Begin
window.onscroll = function() {myFunction()};
// Get the navbar
var navbar = document.getElementById("padding");
var ndNav = document.getElementById('navbar');
// Get the offset position of the navbar
var sticky = navbar.offsetTop;
var ndsticky = ndNav.offsetTop;
// Add the sticky class to the navbar when you reach its scroll position. Remove "sticky" when you leave the scroll position
function myFunction() {
if (window.pageYOffset > sticky) {
navbar.classList.add("sticky")
}else if (window.pageYOffset >= sticky){
navbar.classList.remove("sticky");
}
}
// Pages Link Pop ups
let productLink = document.getElementById('productLinksss');
let swipe = document.getElementById('whyswipe');
productLink.addEventListener('click', () => {
document.getElementById('st-pop-container').style.display = 'block';
document.getElementById('st-pop-container2').style.display = 'none';
})
swipe.addEventListener('click', () => {
document.getElementById('st-pop-container2').style.display = 'block';
document.getElementById('st-pop-container').style.display = 'none';
})
// Switching From login pop up to sign up pop up without animation
document.querySelector('#su').addEventListener('click', () => {
if(document.getElementById('su').innerText = 'Login') {
document.getElementById('su').innerText = 'sign up';
document.getElementById('su').style.display = 'none';
document.getElementById('sus').style.display = 'block';
document.getElementById('st-p').innerText = 'Already have an account?';
document.getElementById('chenge-login').innerText = 'Create Account';
}
})
document.querySelector('#sus').addEventListener('click', () => {
if(document.getElementById('sus').innerText = 'Login'){
document.getElementById('su').style.display = 'block';
document.getElementById('sus').style.display = 'none';
document.getElementById('st-p').innerText = "You don't have an account?";
document.getElementById('chenge-login').innerText = 'Login';
}
})
document.querySelector('#sus-nd').addEventListener('click', () => {
if(document.getElementById('sus-nd').innerText = 'Login') {
document.getElementById('sus-nd').style.display = 'none';
document.getElementById('su-nd').style.display = 'block';
document.getElementById('st-p-nd').innerText = "You don't have an account?";
document.getElementById('chenge-login-nd').innerText = 'Login';
}
})
document.querySelector('#su-nd').addEventListener('click', () => {
if(document.getElementById('su-nd').innerText = 'Sign up') {
document.getElementById('sus-nd').style.display = 'block';
document.getElementById('su-nd').style.display = 'none';
document.getElementById('st-p-nd').innerText = 'Already have an account';
document.getElementById('chenge-login-nd').innerText = 'Create Account';
}
})
// Login And Get Started Hoverring
document.getElementById('st-btn').addEventListener('mousemove', () => {
document.getElementById('padding').style.backgroundColor = '#f1f2ff';
})
document.getElementById('nd-btn').addEventListener('mousemove', () => {
document.getElementById('padding').style.backgroundColor = '#f1f2ff';
})
document.getElementById('nd-btn').addEventListener('mouseleave', () => {
document.getElementById('padding').style.backgroundColor = '';
})
document.getElementById('st-btn').addEventListener('mouseleave', () => {
document.getElementById('padding').style.backgroundColor = '';
})
// Making the Overlay not to scroll to the top on display block
document.getElementById('st-btn').addEventListener('click', () => {
var topp = (window.pageYOffset)+'px';
document.querySelector("html").style.top = '-'+topp;
document.getElementById('overlay').style.display = 'block';
document.querySelector('.login-container').style.display = 'block';
document.querySelector('html').style.position = 'fixed';
document.querySelector('html').style.left = '0';
});
document.getElementById('nd-btn').addEventListener('click', () => {
var toppp = (window.pageYOffset)+'px';
document.getElementById('overlay-nd').style.display = 'block';
document.getElementById('log-cont').style.display = 'block';
document.querySelector('html').style.position = 'fixed';
document.querySelector('html').style.top = '-'+toppp
document.querySelector('html').style.left = '0';
});
document.getElementById('mob-st-btn').addEventListener('click', () => {
document.getElementById('overlay').style.display = 'block';
document.getElementById('padding').style.display = 'none';
});
document.getElementById('mob-nd-btn').addEventListener('click', () => {
document.getElementById('overlay-nd').style.display = 'block';
document.getElementById('padding').style.display = 'none';
});
// Taking out the overlay pop up
document.getElementById('overlay').addEventListener('click', () => {
var scrYY = document.querySelector('html').offsetTop;
document.getElementById('overlay').style.display = 'none';
document.querySelector('html').style.position = 'initial';
});
document.getElementById('overlay-nd').addEventListener('click', () => {
var scrY = document.querySelector('html').offsetTop;
document.getElementById('overlay-nd').style.display = 'none';
document.querySelector('html').style.position = 'initial';
});
// Mouseup functions for the pop ups
document.addEventListener('mouseup', function(e) {
var container2 = document.getElementById('st-pop-container2');
if (!container2.contains(e.target)) {
container2.style.display = 'none';
}
});
document.addEventListener('mouseup', function(e) {
var container = document.getElementById('st-pop-container');
if (!container.contains(e.target)) {
container.style.display = 'none';
}
});
// // The Scroll Timeline at the top of the page
// import "https://flackr.github.io/scroll-timeline/dist/scroll-timeline.js";
// const scrollTracker = document.querySelector('.onscroll');
// const scrollTrackingTimeline = new ScrollTimeline ({
// source: document.scrollingElement,
// orientation: "block",
// scrollOffsets: [CSS.percent(0), CSS.percent(100)]
// });
// scrollTracker.animate(
// {
// transform: ["scaleX(0)", "scaleX(1)"]
// },
// {
// duration: 1,
// timeline: scrollTrackingTimeline,
// }
// );
// Media Queries Pop ups
document.getElementById('Prodtt').addEventListener('click', () => {
document.getElementById('prodt-drop-down-cont').classList.toggle('prodtt-st-toggle');
document.getElementById('drop-downi').classList.toggle('drop-downi-toggle');
})
document.getElementById('prodtt-Nd').addEventListener('click', () => {
document.getElementById('prodt-drop-down-contND').classList.toggle('prodtt-st-toggle');
document.getElementById('drop-downiND').classList.toggle('drop-downi-toggle');
})
document.getElementById('bar-btn').addEventListener('click', () => {
document.getElementById('mobile-pop-up').style.display = 'block';
document.querySelector('html').style.position = 'fixed';
document.getElementById('padding').style.display = 'none';
})
document.getElementById('mob-cancel-btn').addEventListener('click', () => {
document.getElementById('mobile-pop-up').style.display = 'none';
document.querySelector('html').style.position = 'initial';
document.getElementById('padding').style.display = 'block'
document.getElementById('padding').style.animation = 'none'
})