-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
253 lines (207 loc) · 6.75 KB
/
index.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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
var prev = document.getElementById("prev")
prev.addEventListener("click",scroll_left)
function scroll_left(event) {
var content = document.getElementById("fade")
content.scrollLeft -= 540;
event.preventDefault();
if(content.scrollLeft==540){
prev.style.color = "silver"
}
else{
prev.style.color = "grey"
}
}
var next = document.getElementById("next")
next.addEventListener("click",scroll_right)
function scroll_right(event) {
var content = document.getElementById("fade")
content.scrollLeft += 540;
event.preventDefault();
if(content.scrollLeft<=540){
prev.style.color = "silver"
}
else{
prev.style.color = "grey"
}
}
function display(){
var flag_menu = document.getElementsByClassName('flag-menu');
var ul = document.querySelector('ul');
if ( ul.style.display == 'none'){
ul.style.display = 'block';
}
else {
ul.style.display = 'none';
}
}
function showresult(){
var search_data = document.getElementById('item-search').value;
console.log(search_data)
let src = 'https://www.rodanandfields.com/search?';
var params = `q=${search_data}`;
var urlsearchparams = new URLSearchParams(`${src}${params}`);
console.log(urlsearchparams);
var getdata = urlsearchparams.get('q');
location.assign(`${src}${params}`);
window.onload = search_data.value = "";
}
var prev1 = document.getElementById("prev1")
prev1.addEventListener("click",scroll_left1)
var count =0;
var scrollbtn = document.getElementById('topscroll');
var scrolltop = document.documentElement.clientHeight
function slideup() {
window.scrollTo({
top:0,
left: 0,
behavior:"smooth"
});
}
scrollbtn.addEventListener('click',slideup);
//for footer signup
var arr = [];
var flag =1;
function show_msg(){
var signin_email = document.getElementById('signin-email').value;
console.log(signin_email)
localStorage.setItem("signin_email",signin_email);
localStorage.getItem('signin_email');
console.log(signin_email);
if ( signin_email.length == 0 || signin_email.indexOf('@') == -1 || signin_email.indexOf('.com') == -1){
alert('Invalid Email Address');
flag =0;
}
for ( var i = 0 ; i < signin_email.length; i++){
if ( signin_email[i] == '@' || signin_email[i] == '.' || signin_email[i] == 'c' || signin_email[i] == 'o' || signin_email[i] == 'm'){
arr.push(i)
}
}
for ( var i =1; i < arr.length-1; i++){
var num = arr[0];
if ( arr[i+1] > arr[i-1]){
var t = true;
} else {
// alert('give the email in correct order i.e., alphabets-or-number@domainname.com');
}
}
for ( var j = 0; j < signin_email.length; j++){
if ( signin_email[j] == '@'){
lenbefore = j;
if ( lenbefore > 0){
t =true;
}else{
// alert('give sometihng before @');
}
if ( signin_email[j] == '.'){
lenbefore1 = j;
if ( lenbefore1> lenbefore){
t = true;
}else {
// alert('give domain name before .');
}
}
}
} if ( t= true){
var signin_form = document.getElementById('signin-form');
var policy = document.getElementById('policy');
var s_form = document.getElementById('sform');
var s_btn = document.getElementById('sbtn');
var signin_mail = document.getElementById('signin-email');
var p1 = document.createElement('p');
if ( flag == 1){
policy.style.display = "none";
s_form.style.display = "none";
s_btn.style.display = "none";
signin_mail.style.display = "none";
p1.innerText = `You're on the list
Check your inbox for the latest on R+F products,
news, and special offers.`
signin_form.appendChild(p1);
p1.setAttribute('id', 'p1');
}
}
}
function scroll_left1(event) {
var content = document.getElementById("cont8")
var arrow2 = document.getElementById("arrow2")
content.scrollLeft -= 1040;
event.preventDefault();
// console.log(content.scrollLeft)
count--;
if(count<=0){
count=0;
}
if(content.scrollLeft==0){
prev1.style.border = "none"
arrow.style.visibility ='hidden';
arrow2.style.visibility="visible";
next1.style.border="none";
}
else{
prev1.style.border = "thin dotted black"
arrow.style.visibility = 'visible';
arrow2.style.visibility="visible"
}
}
var next1 = document.getElementById("next1")
next1.addEventListener("click",scroll_right1)
function scroll_right1(event) {
var content = document.getElementById("cont8")
content.scrollLeft += 1040;
event.preventDefault();
count++;
var arrow2 = document.getElementById("arrow2")
var arrow = document.getElementById("arrow")
if (count!=0){
next1.style.border = "thin dotted black"
arrow.style.visibility = 'visible';
prev1.style.border="none"
}
if(count>=2){
count=2;
next1.style.border = "none"
arrow2.style.visibility ='hidden';
}
// console.log(count);
}
////////////////////////////////
// var white1= document.getElementById("white");
// white1.addEventListener("mouseenter",pop);
// var black1 = document.getElementById("black");
// black1.addEventListener("mouseover",pop)
function pop(event){
// var black1 = document.getElementById("black");
// black1.style.zIndex ="10";
// black1.style.height ="240"+"px"
// black1.style.position = "absolute"
// black1.style.width ="240"+"px"
// black1.style.background="black"
// black1.style.transform ="translate(0px,-244px)"
// black1.style.opacity="70%"
// document.getElementById("p2").style.visibility="visible"
// document.getElementById("white_img1").style.visibility="visible"
// console.log("hii")
event.target.style.filter = "brightness(0.5)"
}
function pop2(event){
event.target.style.filter = "brightness(1)"
}
// white1.addEventListener("mouseout",img_show);
// black1.addEventListener("mouseout",img_show);
// function img_show(){
// var black1 = document.getElementById("black");
// black1.style.height ="0"+"px"
// black1.style.width ="0"+"px"
// document.getElementById("p2").style.visibility="hidden"
// document.getElementById("white_img1").style.visibility="hidden"
// }
// var x= document.getElementById("white_img1");
// x.addEventListener("mouseover",big);
// function big(){
// x.style.width ="80px"
// x.style.transform="translate(10px, 90px)"
// x.style.marginLeft="75px"
// }
////////////////////////////////////////
var white11 = document.getElementsByClassName("white1")
//console.log(white11)