|
Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /var/www/kamariallee.com/public_html/theme/kamari/js/ |
Upload File : |
document.addEventListener('DOMContentLoaded', function () {
const slidesContainer = document.querySelector('.slides-container')
const indicators = document.querySelectorAll('.indicators')
let currentSlideIndex = 0
// Initialize the carousel
updateCarousel()
// Handle indicator click events
indicators.forEach((indicator, index) => {
indicator.addEventListener('click', () => {
currentSlideIndex = index
updateCarousel()
})
})
function updateCarousel() {
// Update active indicator
indicators.forEach((indicator, index) => {
if (index === currentSlideIndex) {
indicator.classList.add('active')
} else {
indicator.classList.remove('active')
}
})
// Move the slides container to the current slide position
slidesContainer.style.transform = `translateX(-${currentSlideIndex * 100}%)`
}
})
// navbar
const navbar = document.querySelector('.custom-nav')
const promo = document.querySelector('.promo')
// Function to handle scroll event
const handleScroll = () => {
const scrollY = window.scrollY
// Change the background color when scrolling down
if (scrollY > 0) {
navbar.classList.remove('xs:bg-transparent')
navbar.classList.add('bg-primaryTransparent')
promo.classList.remove('show')
promo.classList.add('hidden')
} else {
navbar.classList.remove('bg-primaryTransparent')
navbar.classList.add('xs:bg-transparent')
promo.classList.add('show')
promo.classList.remove('hidden')
}
}
// Attach the scroll event listener
window.addEventListener('scroll', handleScroll)
// bottom sheet
const toggleBtn = document.getElementById('toggleBtn')
const bottomSheet = document.getElementById('bottomSheet')
// Function to toggle the bottom sheet
const toggleBottomSheet = () => {
bottomSheet.classList.toggle('hidden')
}
// Attach click event to the toggle button
toggleBtn.addEventListener('click', toggleBottomSheet)
// mega menu filter
const toggleBtnFilter = document.getElementById('toggleBtnFilter')
const megaMenuFilter = document.getElementById('megaMenuFilter')
// Function to toggle the mega menu
const toggleMegaMenuFilter = () => {
megaMenuFilter.classList.toggle('hidden')
}
// Attach click event to the toggle button
toggleBtnFilter.addEventListener('click', toggleMegaMenuFilter)
// mega menu sort
const toggleBtnSort = document.getElementById('toggleBtnSort')
const megaMenuSort = document.getElementById('megaMenuSort')
// Function to toggle the mega menu
const toggleMegaMenuSort = () => {
megaMenuSort.classList.toggle('hidden')
}
// Attach click event to the toggle button
toggleBtnSort.addEventListener('click', toggleMegaMenuSort)
// accordion
function toggleAccordion(accordionId, arrowId) {
const accordion = document.getElementById(accordionId)
const arrow = document.getElementById(arrowId)
if (window.getComputedStyle(accordion).display === 'none') {
accordion.style.display = 'block'
arrow.classList.add('rotate-180')
} else {
accordion.style.display = 'none'
arrow.classList.remove('rotate-180')
}
}