-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
82 lines (66 loc) · 2.38 KB
/
script.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
// import { todayDeal } from "./todayDeal.js";
// Function to scroll back to top of page
function scrollToTop() {
document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE, and Opera
}
// Show/hide the back to top button based on scroll position
window.onscroll = function () {
const btn = document.getElementById("backToTopBtn");
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
btn.style.display = "block";
} else {
btn.style.display = "none";
}
};
//-------------today deal--------------
// console.log("------Today Deals-------");
// let todayDealProductListEl = document.querySelector(
// ".todays_deals_product_list"
// );
// console.log(todayDealProductListEl);
// let todayDealProductHTML = "";
// let todayDeallength = todayDeal.length;
// for (let i = 0; i < todayDeallength; i++) {
// // console.log(todayDeal[i]);
// todayDealProductHTML += `
// <div class="todays_deals_product_item">
// <div class="todayDeals_product_image">
// <img src=${todayDeal[i].img} />
// </div>
// <div class="discount_Container">
// <a href="#">Up tp ${todayDeal[i].discount} off</a>
// <a href="#">${todayDeal[i].DealofDay}</a>
// </div>
// <p>${todayDeal[i].desc}</p>
// </div>
// `;
// }
// todayDealProductListEl.innerHTML = todayDealProductHTML;
// // console.log(todayDealProductHTML);
// let today_deal_btn_prevEl = document.getElementById("today_deal_btn_prev");
// let today_deal_btn_nextEl = document.getElementById("today_deal_btn_next");
// let today_deals_product_itemEl = document.querySelectorAll(
// ".today_deals_product_item"
// );
// let startProduct = 0;
// today_deal_btn_prevEl.addEventListener("click", () => {
// // alert("prev");
// console.log("taped");
// if (startProduct < 0) {
// startProduct += 500;
// }
// today_deals_product_itemEl.forEach((el) => {
// el.style.transform = `translateX(${startProduct}%)`;
// });
// });
// today_deal_btn_nextEl.addEventListener("click", () => {
// // alert("next");
// console.log("taped");
// if (startProduct > -2000) {
// startProduct -= 500;
// }
// today_deals_product_itemEl.forEach((el) => {
// el.style.transform = `translateX(${startProduct}%)`;
// });
// });