-
Notifications
You must be signed in to change notification settings - Fork 599
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1157 from AsmitaMishra24/main
feat: Redesigned Destinations Section with Hover Card Effect
- Loading branch information
Showing
9 changed files
with
314 additions
and
98 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 |
---|---|---|
@@ -1,28 +1,15 @@ | ||
let lastClickedCard = document.querySelector(".active"); | ||
var swiper = new Swiper('.swiper-container', { | ||
loop: true, | ||
}); | ||
|
||
// Function to handle click events | ||
function handleClick(card) { | ||
// Remove active classes from all cards | ||
const panels = document.querySelectorAll(".card"); | ||
panels.forEach(panel => panel.classList.remove("active")); | ||
|
||
// Add active class to the clicked card | ||
card.classList.add("active"); | ||
lastClickedCard = card; // Update the reference to the last clicked card | ||
function goToNextSlide() { | ||
swiper.slideNext(); | ||
} | ||
|
||
// Attach click event listener to all cards | ||
const panels = document.querySelectorAll(".card"); | ||
panels.forEach(panel => panel.addEventListener("click", () => handleClick(panel))); | ||
function goToPrevSlide() { | ||
swiper.slidePrev(); | ||
} | ||
|
||
// Adjust the mouseover event listener | ||
panels.forEach(panel => { | ||
panel.addEventListener('mouseover', () => { | ||
lastClickedCard.classList.remove("active"); | ||
panel.classList.add('active'); | ||
}); | ||
panel.addEventListener('mouseout', () => { | ||
panel.classList.remove('active'); | ||
lastClickedCard.classList.add("active"); | ||
}); | ||
}); | ||
document.querySelector('.swiper-button-next').addEventListener('click', goToNextSlide); | ||
document.querySelector('.swiper-button-prev').addEventListener('click', goToPrevSlide); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.