-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
35 lines (29 loc) · 841 Bytes
/
scripts.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
'use strict';
//MOBILE NAVIGATION MENU TOGGLE BUTTON
function toggleBtn() {
const menu = document.getElementById('mobile-menu');
menu.classList.toggle('active-btn');
const main = document.querySelector('.tint');
main.classList.toggle('color-tint');
}
//PRODUCT INCREASE QUANTITY BUTTON
function increaseQuantity(elem) {
elem.previousElementSibling.value++;
}
//PRODUCT DECREASE QUANTITY BUTTON
function decreaseQuantity(elem) {
if (parseInt(elem.nextElementSibling.value) - 1 < 1) {
alert('Cannot add less than 1 product');
elem.nextElementSibling.value = 1;
} else {
parseInt(elem.nextElementSibling.value--);
}
}
//GO BACK BUTTON
function goBackButton() {
window.history.back();
}
const creditDiv = document.getElementById('credit-div');
function showCredit() {
creditDiv.classList.toggle('hide');
}