-
Notifications
You must be signed in to change notification settings - Fork 0
/
Home.html
98 lines (90 loc) · 3.87 KB
/
Home.html
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Page Attributes -->
<meta name="description" content="Your page description here">
<meta property="og:title" content="Home">
<meta property="og:description" content="Your page description here">
<meta property="og:image" content="image.jpg">
<meta property="og:url" content="https://www.example.com">
<!-- End Page Attributes -->
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="styles.css">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
<script src="scripts.js" defer></script>
<title>BudBros</title>
</head>
<body>
<header>
<h1>Welcome to BudBros</h1>
</header>
<main>
<section id="products">
<h2>Products:</h2>
<div class="product-slider">
<div class="slider-container">
<button class="prev">Previous</button>
<div class="slider">
<div class="slide">
<img src="https://static.wixstatic.com/media/22e53e_2fee033b2eca46cab4eec7fa74e99c31~mv2.jpg" alt="Product 1">
<p>I'm a product</p>
<p>R85,00</p>
<div class="quantity-counter">
<button class="decrement">-</button>
<input type="text" value="1" class="qty_text" readonly placeholder="1">
<button class="increment">+</button>
</div>
<button>Add to Cart</button>
</div>
<div class="slide">
<img src="https://static.wixstatic.com/media/22e53e_422c96a46cfd4873b36279bc94bf5bd4~mv2.jpg" alt="Product 2">
<p>I'm a product</p>
<p>R85,00</p>
<div class="quantity-counter">
<button class="decrement">-</button>
<input type="text" value="1" class="qty_text" readonly placeholder="1">
<button class="increment">+</button>
</div>
<button>Add to Cart</button>
</div>
</div>
<button class="next">Next</button>
</div>
</div>
</section>
</main>
<footer>
<p>© 2024 BudBros. All rights reserved.</p>
</footer>
<script>
const prevButton = document.querySelector('.prev');
const nextButton = document.querySelector('.next');
const slider = document.querySelector('.slider');
let scrollAmount = 0;
nextButton.addEventListener('click', () => {
slider.scrollBy({ left: 230, behavior: 'smooth' });
scrollAmount += 230;
});
prevButton.addEventListener('click', () => {
slider.scrollBy({ left: -230, behavior: 'smooth' });
scrollAmount -= 230;
});
document.querySelectorAll('.increment').forEach(button => {
button.addEventListener('click', () => {
const qtyText = button.previousElementSibling;
qtyText.value = parseInt(qtyText.value) + 1;
});
});
document.querySelectorAll('.decrement').forEach(button => {
button.addEventListener('click', () => {
const qtyText = button.nextElementSibling;
if (parseInt(qtyText.value) > 1) {
qtyText.value = parseInt(qtyText.value) - 1;
}
});
});
</script>
</body>
</html>