-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbeauty.js
87 lines (74 loc) · 2.41 KB
/
beauty.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
// countdown
var countdown = () => {
var countDate = new Date("November 18, 2021 00:00:00").getTime();
var now = new Date().getTime();
var gap = countDate - now;
// console.log(countDate);
//how the time work?
var now = new Date().getTime();
var second = 1000;
var minute = second * 60;
var hour = minute * 60;
var day = hour * 24;
//calculate how many days is there
var textDay = Math.floor(gap / day);
// console.log(textDay)
var textHour = Math.floor((gap % day) / hour);
var textMinute = Math.floor((gap % hour) / minute);
var textSecond = Math.floor((gap % minute) / second);
document.querySelector(".day").innerHTML = textDay;
document.querySelector(".hour").innerHTML = textHour;
document.querySelector(".minute").innerHTML = textMinute;
document.querySelector(".second").innerHTML = textSecond;
};
// console.log(15%2); divided by hour
// countdown();
setInterval(countdown, 1000);
// slider
var myIndex = 0;
showslides();
function showslides() {
var i;
var x = document.getElementsByClassName("myslides");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
myIndex++;
if (myIndex > x.length) {
myIndex = 1;
}
x[myIndex - 1].style.display = "block";
setTimeout(showslides, 3000); // Change image every 2 seconds
}
// home tab
document.getElementById("home").addEventListener("click", function () {
window.location.href = "index.html";
});
// kids tab
document.getElementById("kids").addEventListener("click", function () {
window.location.href = "kids.html";
});
// logo
document.getElementById("logo").addEventListener("click", function () {
window.location.href = "index.html";
});
// men tab
document.getElementById("men").addEventListener("click", function () {
window.location.href = "men.html";
});
// curve+plus tab
document.getElementById("curve+plus").addEventListener("click", function () {
window.location.href = "curve+plus.html";
});
// beauty tab
document.getElementById("beauty").addEventListener("click", function () {
window.location.href = "beauty.html";
});
var cartData = JSON.parse(localStorage.getItem("cartData"));
var favProductsData = JSON.parse(localStorage.getItem("favProductsData"));
// no. of cart items show when page is loading
// no. of fav cart items show when page is loading
window.onload = function () {
document.getElementById("bagItemsCount").textContent = cartData.length;
document.getElementById("favItemsCount").textContent = favProductsData.length;
};