Skip to content

Commit

Permalink
fixing buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
Lescano713 committed Sep 2, 2024
1 parent f95db65 commit 1a96bb1
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ function addToArray(product){
}else if(product.quantity < 1){
removeProduct(product.id)
}
if (productsInCart.length < 1) {
if (productsInCart.length <= 0) {
restore()
}else{
uploadingCart(productsInCart)
Expand Down Expand Up @@ -291,4 +291,30 @@ function restore(){

// function dependingButton(product){
// if(!findId(product.id))
// }
// }

function buttonAmount(){
const div = document.createElement('div');
div.innerHTML = `
<button type='button' id="take-off-product">
<img src="./assets/images/icon-decrement-quantity.svg"/>
</button>
<p></p>
<button type='button' id="add-product">
<img src="./assets/images/icon-increment-quantity.svg"/>
</button>`

}

function addEvents(){
const takeOff = document.querySelector('#take-off-product');
const add = document.querySelector('add-product');

takeOff.addEventListener('click', e =>{
addAmount(id,p)
});
add.addEventListener('click', e =>{
takeOffProducts(id, p);
targetProduct(id,img)
});
}

0 comments on commit 1a96bb1

Please sign in to comment.