forked from PriyaGhosal/SkillWise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
E-Book.html
372 lines (325 loc) · 11.8 KB
/
E-Book.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
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>E-Books</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
/* General styling */
html{
scroll-behavior: smooth;
}
body {
font-family: 'Roboto', sans-serif;
background-color: #fff4f4; /* Soft pastel pink */
color: #333;
padding: 0;
margin: 0;
}
/* Navbar */
.navbar {
background-color: hsl(357, 100%, 75%);
padding: 10px 20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.navbar-brand {
font-size: 1.5rem;
color: white;
font-weight: bold;
}
.nav-link {
color: white;
font-size: 1.2rem;
margin-right: 20px;
text-decoration: none;
cursor: pointer; /* Change cursor to pointer */
}
.nav-link:hover {
color: #f1f1f1;
}
/* Shop Title */
.shop-title {
text-align: center;
margin-top: 20px;
font-size: 2.5rem;
font-weight: bold;
color: hsl(357, 100%, 75%);
}
/* Product Grid */
.product-container {
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 30px;
margin: 30px 20px;
}
.product-card {
background-color: white;
border-radius: 10px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
padding: 20px;
text-align: center;
width: 250px;
transition: transform 0.2s ease-in-out;
}
.product-card:hover {
transform: scale(1.05);
}
.product-card img {
max-width: 100%;
height: auto;
margin-bottom: 15px;
}
.product-card h3 {
font-size: 1.4rem;
margin: 10px 0;
color: hsl(357, 100%, 75%);
}
.product-card p {
font-size: 1.2rem;
color: #ff6799;
margin-bottom: 15px;
}
.product-card button {
background-color: hsl(357, 100%, 75%);
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
}
.product-card button:hover {
background-color: hsl(357, 100%, 65%);
}
/* Cart Section */
.cart-section {
text-align: center;
margin: 50px 0;
}
.cart-items {
list-style-type: none;
padding: 0px;
}
.cart-items li {
margin: 10px 0;
display: flex;
justify-content: space-evenly;
align-items: center;
}
.cart-controls {
display: flex;
gap: 10px;
}
.cart-controls button {
background-color: hsl(357, 100%, 75%);
padding: 10px;
color: white;
border: none;
border-radius: 10px;
cursor: pointer;
}
.cart-controls button:hover {
background-color: hsl(357, 100%, 65%);
}
/* FAQ Section */
.faq-section {
font-size :1em;
margin: 50px 20px;
padding: 20px;
border-radius: 10px;
border: 1px solid hsl(357, 100%, 75%);
}
.faq-section h2,.cart-section h2{
color: hsl(357, 100%, 75%)
}
.faq-item{
margin-bottom:10px;
padding: 10px;
border: hsl(357, 100%, 75%) solid 2px;
border-radius: 10px;
}
.faq-question {
font-weight: bold;
cursor: pointer; /* Add pointer cursor for FAQ questions */
display:flex;
justify-content: space-between;
}
.toggle-btn {
background-color: hsl(357, 100%, 75%);
color: white;
border: none;
border-radius:10px;
width: 28px;
height: 28px;
font-size: 15px;
line-height: 24px;
text-align: center;
cursor: pointer;
transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
/* "Why Use Our Books" Section */
.why-section {
margin: 50px 20px;
padding: 20px;
background-color: white;
border-radius: 10px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
.why-section h2 {
margin-bottom: 10px;
color: hsl(357, 100%, 75%);
}
.why-section ul {
list-style-type: disc;
padding-left: 20px;
}
.why-section li{
margin: 10px;
}
/* Footer */
footer {
background-color: hsl(357, 100%, 75%);
color: white;
padding: 20px 0;
text-align: center;
}
/* Responsive Design */
@media (max-width: 768px) {
.product-container {
flex-direction: column;
align-items: center;
}
.product-card {
width: 100%;
max-width: 300px;
}
}
</style>
</head>
<body>
<!-- Navbar -->
<nav class="navbar">
<div class="navbar-brand">Buy Our eBooks</div>
<div>
<a class="nav-link" href="index.html">Home</a>
<a class="nav-link" href="#">Products</a>
<a class="nav-link" href="#cart-section" >Cart</a> <!-- Add click event to scroll -->
</div>
</nav>
<!-- Shop Title -->
<h1 class="shop-title">Our Books Collection</h1>
<!-- Product Container -->
<div class="product-container">
<div class="product-card">
<img src="https://rukminim2.flixcart.com/image/850/1000/l51d30w0/book/p/n/o/java-programming-language-learn-java-from-basic-to-advance-2022-original-imagfsqsfcqzzrjj.jpeg?q=90" alt="Java Book">
<h3>Learn Java</h3>
<p>$15</p>
<button onclick="addToCart('Learn Java', 15)">Add to Cart</button>
</div>
<div class="product-card">
<img src="https://images-na.ssl-images-amazon.com/images/S/compressed.photo.goodreads.com/books/1577622829i/50076664.jpg" alt="Python Book">
<h3>Learn Python</h3>
<p>$12</p>
<button onclick="addToCart('Learn Python', 12)">Add to Cart</button>
</div>
<div class="product-card">
<img src="https://d24f1whwu8r3u4.cloudfront.net/assets/book-covers/dsa-460d6841c2af7be347922d3d151987862d14b7f12d6c5caba28df01dbb7da687.png" alt="DSA Book">
<h3>DSA Mastery</h3>
<p>$18</p>
<button onclick="addToCart('DSA Mastery', 18)">Add to Cart</button>
</div>
</div>
<!-- Why Use Our Books Section -->
<div class="why-section">
<h2>Why Use Our Books?</h2>
<ul>
<li>Comprehensive content tailored for all levels of learners.</li>
<li>Real-world coding challenges and examples.</li>
<li>Lifetime updates with new editions and content.</li>
<li>Accessible in multiple formats for convenience.</li>
</ul>
</div>
<!-- FAQ Section -->
<div class="faq-section">
<h2>Frequently Asked Questions</h2>
<div class="faq-item">
<div class="faq-question" onclick="toggleAnswer(this)">Q: What formats are the eBooks available in?<button class="toggle-btn"><i class="fa-solid fa-chevron-down"></i></button></div>
<p class="faq-answer" style="display: none;">A: Our eBooks are available in PDF, EPUB, and MOBI formats.</p>
</div>
<div class="faq-item">
<div class="faq-question" onclick="toggleAnswer(this)">Q: Can I read the eBooks on my tablet?<button class="toggle-btn"><i class="fa-solid fa-chevron-down"></i></button></div>
<p class="faq-answer" style="display: none;">A: Yes, our eBooks can be read on any device that supports the eBook format.</p>
</div>
<div class="faq-item">
<div class="faq-question" onclick="toggleAnswer(this)">Q: What payment methods are accepted?<button class="toggle-btn"><i class="fa-solid fa-chevron-down"></i></button></div>
<p class="faq-answer" style="display: none;">A: We accept all major credit cards and PayPal for your convenience.</p>
</div>
<div class="faq-item">
<div class="faq-question" onclick="toggleAnswer(this)">Q: Is there a money-back guarantee?<button class="toggle-btn"><i class="fa-solid fa-chevron-down"></i></button></div>
<p class="faq-answer" style="display: none;">A: Yes, we offer a 30-day money-back guarantee on all purchases.</p>
</div>
</div>
<!-- Cart Section -->
<div class="cart-section" id="cart-section">
<h2>Your Cart</h2>
<ul class="cart-items" id="cart-items"></ul>
<h3>Total: $<span id="cart-total">0</span></h3>
</div>
<!-- Footer -->
<footer>
<p>© 2024 Eco-Friendly Shop. All Rights Reserved.</p>
<p>Made with ♥ by Priya Ghosal</p>
</footer>
<script>
let cart = [];
function addToCart(name, price) {
const item = cart.find(product => product.name === name);
if (item) item.quantity++;
else cart.push({ name, price, quantity: 1 });
updateCart();
}
function removeFromCart(name) {
const item = cart.find(product => product.name === name);
if (item) {
item.quantity--;
if (item.quantity === 0) {
cart = cart.filter(product => product.name !== name);
}
}
updateCart();
}
function updateCart() {
const cartItemsElement = document.getElementById('cart-items');
const cartTotalElement = document.getElementById('cart-total');
cartItemsElement.innerHTML = '';
let total = 0;
cart.forEach(item => {
const listItem = document.createElement('li');
listItem.textContent = `${item.name} (x${item.quantity}) - $${item.price * item.quantity}`;
const controls = document.createElement('div');
controls.className = 'cart-controls';
const removeButton = document.createElement('button');
removeButton.textContent = 'Remove';
removeButton.onclick = () => removeFromCart(item.name);
controls.appendChild(removeButton);
listItem.appendChild(controls);
cartItemsElement.appendChild(listItem);
total += item.price * item.quantity;
});
cartTotalElement.textContent = total.toFixed(2);
}
function toggleAnswer(questionElement) {
const answerElement = questionElement.nextElementSibling;
const isVisible = answerElement.style.display === 'block';
answerElement.style.display = isVisible ? 'none' : 'block';
}
function scrollToCart() {
const cartSection = document.getElementById('cart-section');
cartSection.scrollIntoView({ behavior: 'smooth' });
}
</script>
</body>
</html>