// Wait for the page to load
window.addEventListener("load", function () {
// Find the preloader element
const preloader = document.querySelector(".preloader");
if (preloader) {
// Add a class to hide the preloader
preloader.classList.add("preloader-deactivate");
}
});
const currentUrl = window.location.href;
// Check if the current URL matches any of the menu links
if (currentUrl.includes("/")) {
document.getElementById("home-link").classList.add("active");
} else if (currentUrl.includes("/about")) {
document.getElementById("about-link").classList.add("active");
} else if (currentUrl.includes("/services")) {
document.getElementById("services-link").classList.add("active");
} else if (currentUrl.includes("/testimonial")) {
document.getElementById("testimonial-link").classList.add("active");
} else if (currentUrl.includes("/contact")) {
document.getElementById("contact-link").classList.add("active");
}
// Find the navbar element
const navbar = document.querySelector(".navbar");
// Get the offset position of the navbar
const navbarOffset = navbar.offsetTop;
// Add a scroll event listener to the window
window.addEventListener("scroll", function () {
// Check if the current scroll position is greater than or equal to the offset position of the navbar
if (window.pageYOffset >= navbarOffset) {
// Add a class to make the navbar sticky
navbar.classList.add("sticky");
} else {
// Remove the class to make the navbar not sticky
navbar.classList.remove("sticky");
}
});
$(".campus-experience-slider").owlCarousel({
items: 1,
loop: true,
margin: 0,
nav: false,
dots: false,
autoplay: true,
smartSpeed: 1000,
autoplayHoverPause: true,
navText: [
"",
"",
],
});
$(".go-top").on("click", function () {
$("html, body").animate({ scrollTop: "0" }, 50);
});
$(".popup-youtube, .popup-vimeo").magnificPopup({
disableOn: 300,
type: "iframe",
mainClass: "mfp-fade",
removalDelay: 160,
preloader: false,
fixedContentPos: false,
});
$(".open-popup-link").magnificPopup({
type: "inline",
midClick: true, // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href.
});