AOS.init({ once: true })
$(document).ready(function () {
var url = window.location.pathname;
var filename = url.substring(url.lastIndexOf('/') + 1);
if (filename == "") {
filename = "index.php"
}
$("header .nav-item .nav-link").removeClass("active");
$(`header .nav-item .nav-link[href="${filename}"]`).addClass("active")
});
// (function () {
// perfData = window.performance.timing; // The PerformanceTiming interface represents timing-related performance information for the given page.
// const EstimatedTime = -(perfData.loadEventEnd - perfData.navigationStart);
// const time = parseInt((EstimatedTime / 1000) % 60) * 100;
// $("#loader ul").css({ transform: 'translateY(-99%)', transition: time + 'ms ease-in-out' });
// $("#loader .side-loader").css({ height: '0', transition: time + 'ms ease-in-out' });
// console.log('time', time)
// $('.banner-wrapper-main .home-banner .banner-img-wrap').css({ transform: 'scaleY(1)', transition: 'transform ' + time + 'ms ease-in-out, width 3s ease-in-out' });
// setTimeout(() => {
// setTimeout(() => {
// $('body').addClass('loaded')
// }, 1000);
// $("#loader").fadeOut('300')
// }, time + 1500);
// })()
(function () {
const perfData = window.performance.timing; // The PerformanceTiming interface represents timing-related performance information for the given page.
const EstimatedTime = -(perfData.loadEventEnd - perfData.navigationStart);
const time = parseInt((EstimatedTime / 1000) % 60) * 100;
$("header .nav-wrap .navbar-brand").css({height: $(".loader-header").height(),width: $(".loader-header").width()})
$("#loader ul").css({ transform: 'translateY(-99%)', transition: time + 'ms ease-in-out' });
$("#loader .wrap-content #ball").css({animationDuration: time + 'ms'})
$("#loader .side-loader").css({ height: '0', transition: time + 'ms ease-in-out' });
console.log('time', time)
$('.banner-wrapper-main .home-banner .banner-img-wrap').css({ transform: 'scaleY(1)', transition: 'transform ' + time + 'ms ease-in-out, width 3s ease-in-out' });
setTimeout(() => {
$(".loader-header").css({top: `calc(50% - 50px)`})
setTimeout(() => {
$("#loader").fadeOut('300')
$("#loader").css({background: '#fff'})
const position = $("header .nav-wrap .navbar-brand").offset()
$(".loader-header").css({top: `${position.top}px`,left: `${position.left}px`})
$("header nav").addClass('animate')
$(".main-banner").addClass('animate')
setTimeout(() => {
$("header .nav-wrap .navbar-brand").html($(".loader-header"))
$(".loader-header").css({position: 'static'})
}, 1000);
$('body').addClass('loaded')
}, 1000);
}, time > 1500 ? (time - 1000) : time);
})()
document.addEventListener('DOMContentLoaded', function() {
// Get the header element
var header = document.querySelector('.navbar');
// Function to add or remove class based on scroll position
function onScroll() {
if (window.scrollY > 50) { // Change 50 to the scroll position you prefer
header.classList.add('scrolled');
} else {
header.classList.remove('scrolled');
}
}
// Listen for the scroll event
window.addEventListener('scroll', onScroll);
// Call onScroll to ensure correct initial state
onScroll();
});
$(document).ready(function () {
$("body").addClass('animate')
})
// const locoScroll = new LocomotiveScroll({
// el: document.querySelector("main"),
// smooth: true
// });
gsap.registerPlugin(ScrollTrigger, ScrollSmoother);
// ScrollSmoother.create({
// // wrapper: 'body',
// content: 'main',
// smooth: 1, // how long (in seconds) it takes to "catch up" to the native scroll position
// effects: true, // looks for data-speed and data-lag attributes on elements
// smoothTouch: 0.1, // much shorter smoothing time on touch devices (default is NO smoothing on touch devices)
// });
$('.theme-1').owlCarousel({
loop: true,
margin: 10,
nav: true,
dots: false,
responsive: {
0: {
items: 1
},
600: {
items: 3
},
1000: {
items: 2.3
},
navText: ['<i class="fa-solid fa-chevron-left"></i>','<i class="fa-solid fa-chevron-right"></i>']
},
onInitialized: addActiveClass, // Add active class when carousel initializes
onTranslated: addActiveClass // Add active class when carousel finishes sliding
});
function addActiveClass() {
var $activeItems = $('.theme-1 .owl-item.active');
$('.theme-1 .owl-item').removeClass('current'); // Remove 'current' class from all slides
$('.theme-1 .owl-item').removeClass('last'); // Remove 'current' class from all slides
$activeItems.eq(0).addClass('current'); // Add 'current' class to the first visible slide
$activeItems.eq(2).addClass('last'); // Add 'current' class to the first visible slide
}
// Initialize Owl Carousel
$('.theme-silder').owlCarousel({
loop: true,
margin: 10,
nav: true,
arrow:true,
autoplay: true, // Fixed spelling for autoplay
autoplayTimeout: 3000, // Sets autoplay speed to 3 seconds
responsive: {
0: {
items: 1
},
600: {
items: 3
},
1000: {
items: 3
}
}
});
// Initialize FancyBox
$('[data-fancybox="gallery"]').fancybox({
buttons: [
"zoom",
"slideShow",
"close"
],
loop: true
});
// If you're using jQuery or another library, adapt the code accordingly
// Otherwise, pure JavaScript can be used to manage the dropdown behavior
const kidsDropdown = document.getElementById('kidsDropdown');
const kidsDropdownToggle = kidsDropdown.parentElement.querySelector('.dropdown-toggle');
kidsDropdownToggle.addEventListener('mouseenter', () => {
kidsDropdown.classList.add('show'); // Add a class (e.g., 'show') to display the dropdown
});
kidsDropdownToggle.addEventListener('mouseleave', () => {
kidsDropdown.classList.remove('show'); // Remove the class to hide the dropdown
});
document.getElementById('playEquipmentDropdown').addEventListener('click', function(event) {
// Check if the click happened specifically on the dropdown toggle icon
if (event.target.classList.contains('dropdown-toggle') && event.target.closest('.nav-item')) {
// Prevent default behavior to keep the dropdown open without navigating
if (event.offsetX > event.target.clientWidth - 30) {
event.preventDefault();
// Toggle the dropdown menu manually
const dropdown = new bootstrap.Dropdown(event.target);
dropdown.toggle();
}
}
});