-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleaned up the files + distructured the js file to each logic its own…
… file
- Loading branch information
1 parent
bf26e21
commit 089b1c5
Showing
4 changed files
with
59 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// selecting elements | ||
const customerBottomsLRIds = document.querySelectorAll( | ||
"#customer-Bottoms-L-R-Ids" | ||
); | ||
const customersCardsHolderEl = document.getElementsByClassName( | ||
"customers-Cards-Holder" | ||
)[0]; | ||
const customerBottomBtns = document.querySelectorAll(".customer-Bottom-Btns"); | ||
|
||
// gelobal variables | ||
let slideCount = 0; | ||
|
||
// functions | ||
const changeCustomerCard = (index) => { | ||
customerBottomBtns.forEach((customerBBtn) => { | ||
customerBBtn.classList.remove("active"); | ||
}); | ||
customersCardsHolderEl.style.transform = `translateX(-${index}00%)`; | ||
customerBottomBtns[index].classList.add("active"); | ||
}; | ||
|
||
// dots logic | ||
const dotBottomStylingLogic = (index) => { | ||
index === 0 | ||
? slideCount >= 1 | ||
? slideCount-- | ||
: (slideCount = customerBottomBtns.length - 1) | ||
: slideCount < 2 | ||
? slideCount++ | ||
: (slideCount = 0); | ||
changeCustomerCard(slideCount); | ||
}; | ||
|
||
// event linsters | ||
customerBottomsLRIds.forEach((lrBtns, index) => { | ||
lrBtns.addEventListener("click", () => dotBottomStylingLogic(index)); | ||
}); | ||
|
||
customerBottomBtns.forEach((customerDownBtn, index) => { | ||
customerDownBtn.addEventListener("click", () => | ||
changeCustomerCard((slideCount = index)) | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// selecting elements | ||
const burgerMenuWrap = document.getElementsByClassName("burger-Menu-Wrap")[0]; | ||
const navRightLinksWrapEl = document.getElementsByClassName( | ||
"nav-Right-Links-Wrap" | ||
)[0]; | ||
|
||
// functions | ||
const openNav = () => { | ||
navRightLinksWrapEl.classList.toggle("active"); | ||
}; | ||
|
||
// event linsters | ||
burgerMenuWrap.addEventListener("click", openNav); |