Skip to content

Commit

Permalink
Added logic to dropdown icon to flip when open or closed
Browse files Browse the repository at this point in the history
  • Loading branch information
tramirez30 committed Dec 16, 2024
1 parent cb5ab78 commit 42977cc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,14 @@ let clearQuote = () => {

// Targets dropdown input
let dropDown = document.querySelector(".dropdown");
let icon = document.querySelector(".fas.fa-angle-down");

let isActive = (e) => {
//Check to see if dropdown was selected
if (dropDown.contains(e.target)) {
// Toggles dropdown
dropDown.classList.toggle("is-active");
icon.classList = "fas fa-angle-up";
} else {
closeDropdown();
}
Expand All @@ -121,6 +123,7 @@ let isActive = (e) => {

let closeDropdown = () => {
dropDown.classList.remove("is-active");
icon.classList = "fas fa-angle-down";
};

// Event Listener, runs Quote() after click
Expand Down

0 comments on commit 42977cc

Please sign in to comment.