(function($) {
"use strict";
const $documentOn = $(document);
const $windowOn = $(window);
$documentOn.ready( function() {
/* ================================
Mobile Menu Js Start
================================ */
$('#mobile-menu').meanmenu({
meanMenuContainer: '.mobile-menu',
meanScreenWidth: "1199",
meanExpand: [''],
});
$('#mobile-menus').meanmenu({
meanMenuContainer: '.mobile-menus',
meanScreenWidth: "19920",
meanExpand: [''],
});
$documentOn.on("click", ".mean-expand", function () {
let icon = $(this).find("i");
if (icon.hasClass("fa-plus")) {
icon.removeClass("fa-plus").addClass("fa-minus");
} else {
icon.removeClass("fa-minus").addClass("fa-plus");
}
});
/* ================================
Sidebar Toggle & Sticky Item Logic
================================ */
// Open offcanvas
$(".sidebar__toggle").on("click", function () {
$(".offcanvas__info").addClass("info-open");
$(".offcanvas__overlay").addClass("overlay-open");
// Hide sticky item
$(".sidebar-sticky-item").fadeOut().removeClass("active");
});
// Close offcanvas
$(".offcanvas__close, .offcanvas__overlay").on("click", function () {
$(".offcanvas__info").removeClass("info-open");
$(".offcanvas__overlay").removeClass("overlay-open");
// Show sticky item
$(".sidebar-sticky-item").fadeIn().addClass("active");
});
/* ================================
Body Overlay Js Start
================================ */
$(".body-overlay").on("click", function () {
$(".offcanvas__area").removeClass("offcanvas-opened");
$(".df-search-area").removeClass("opened");
$(".body-overlay").removeClass("opened");
// Show sticky item when overlay clicked
$(".sidebar-sticky-item").fadeIn().addClass("active");
});
/* ================================
Offcanvas Link Click (Optional)
================================ */
$(".offcanvas a").on("click", function () {
$(".sidebar-sticky-item").fadeIn().addClass("active");
});
/* ================================
Sticky Header Js Start
================================ */
$windowOn.on("scroll", function () {
if ($(this).scrollTop() > 250) {
$("#header-sticky").addClass("sticky");
} else {
$("#header-sticky").removeClass("sticky");
}
});
/* ================================
Video & Image Popup Js Start
================================ */
$(".img-popup").magnificPopup({
type: "image",
gallery: {
enabled: true,
},
});
$(".video-popup").magnificPopup({
type: "iframe",
callbacks: {},
});
/* ================================
Counterup Js Start
================================ */
$(".count").counterUp({
delay: 15,
time: 4000,
});
/* ================================
Wow Animation Js Start
================================ */
new WOW().init();
/* ================================
Nice Select Js Start
================================ */
if ($('.single-select').length) {
$('.single-select').niceSelect();
}
/* ================================
Parallaxie Js Start
================================ */
if ($('.parallaxie').length && $(window).width() > 991) {
if ($(window).width() > 768) {
$('.parallaxie').parallaxie({
speed: 0.55,
offset: 0,
});
}
}
/* ================================
Hover Active Js Start
================================ */
$(".counter-box, .service-card-item, .choose-list li, .feature-box-style-3, .about-wrapper-5 .about-icon-item, .service-box-style-5, .counter-box-style-5, .work-process-box-style-4, .contact-info-box").hover(
// Function to run when the mouse enters the element
function () {
// Remove the "active" class from all elements
$(".counter-box, .service-card-item, .choose-list li, .feature-box-style-3, .about-wrapper-5 .about-icon-item, .service-box-style-5, .counter-box-style-5, .work-process-box-style-4, .contact-info-box").removeClass("active");
// Add the "active" class to the currently hovered element
$(this).addClass("active");
}
);
/* ================================
Button Hover Js Start
================================ */
if (typeof gsap !== "undefined") {
const hoverBtns = gsap.utils.toArray(".wt-hover-btn-wrapper");
const hoverBtnItems = gsap.utils.toArray(".wt-hover-btn-item");
if (hoverBtns.length && hoverBtnItems.length) {
hoverBtns.forEach((btn, i) => {
const $btn = $(btn);
$btn.on("mousemove", function (e) {
const relX = e.pageX - $btn.offset().left;
const relY = e.pageY - $btn.offset().top;
gsap.to(hoverBtnItems[i], {
duration: 0.6,
x: ((relX - $btn.width() / 2) / $btn.width()) * 60,
y: ((relY - $btn.height() / 2) / $btn.height()) * 60,
ease: "power2.out"
});
});
$btn.on("mouseleave", function () {
gsap.to(hoverBtnItems[i], {
duration: 0.6,
x: 0,
y: 0,
ease: "power2.out"
});
});
});
}
}
/* ================================
Scrolldown Js Start
================================ */
$("#scrollDown").on("click", function () {
setTimeout(function () {
$("html, body").animate({ scrollTop: "+=1000px" }, "slow");
}, 1000);
});
/* ================================
Brand Slider Js Start
================================ */
if ($('.brand-slider').length > 0) {
const brandSlider = new Swiper(".brand-slider", {
spaceBetween: 30,
speed: 1300,
loop: true,
autoplay: {
delay: 2000,
disableOnInteraction: false,
},
navigation: {
nextEl: ".array-next",
prevEl: ".array-prev",
},
breakpoints: {
1399: {
slidesPerView: 6,
},
1199: {
slidesPerView: 5.5,
},
991: {
slidesPerView: 4.5,
},
767: {
slidesPerView: 3.3,
},
575: {
slidesPerView: 2,
},
0: {
slidesPerView: 1.6,
},
},
});
}
/* ================================
Feature Box Slider Js Start
================================ */
if ($('.feature-box-slider').length > 0) {
const featureBoxSlider = new Swiper(".feature-box-slider", {
spaceBetween: 30,
speed: 1300,
loop: true,
autoplay: {
delay: 2000,
disableOnInteraction: false,
},
navigation: {
nextEl: ".array-next",
prevEl: ".array-prev",
},
pagination: {
el: ".dot",
clickable: true,
},
breakpoints: {
1199: {
slidesPerView: 4,
},
991: {
slidesPerView: 3,
},
767: {
slidesPerView: 2,
},
575: {
slidesPerView: 1.5,
},
0: {
slidesPerView: 1.2,
},
},
});
}
/* ================================
Feature Box Slider Js Start
================================ */
if ($('.service-slider-3').length > 0) {
const serviceSlider3 = new Swiper(".service-slider-3", {
spaceBetween: 30,
speed: 1300,
loop: true,
centeredSlides: true,
autoplay: {
delay: 2000,
disableOnInteraction: false,
},
navigation: {
nextEl: ".array-next",
prevEl: ".array-prev",
},
pagination: {
el: ".dot",
clickable: true,
},
breakpoints: {
1399: {
slidesPerView: 4,
},
1199: {
slidesPerView: 3.4,
},
991: {
slidesPerView: 2.8,
},
767: {
slidesPerView: 2,
},
575: {
slidesPerView: 1.5,
},
0: {
slidesPerView: 1.2,
},
},
});
}
/* ================================
Project Slider Js Start
================================ */
if ($('.project-slider').length > 0) {
const projectSlider = new Swiper(".project-slider", {
spaceBetween: 30,
speed: 1300,
loop: true,
centeredSlides: true,
navigation: {
nextEl: ".array-next",
prevEl: ".array-prev",
},
autoplay: {
delay: 2000,
disableOnInteraction: false,
},
pagination: {
el: ".dot",
clickable: true,
},
breakpoints: {
1399: {
slidesPerView: 4,
},
1199: {
slidesPerView: 4,
},
991: {
slidesPerView: 3,
},
767: {
slidesPerView: 2,
},
575: {
slidesPerView: 1.5,
},
0: {
slidesPerView: 1.2,
},
},
});
}
/* ================================
Testimonial Slider Js Start
================================ */
if ($('.testimonial-slider-content').length) {
var slider = new Swiper ('.testimonial-slider-content', {
slidesPerView: 1,
spaceBetween: 30,
navigation: true,
centeredSlides: true,
speed: 1300,
loop: true,
loopedSlides: 6,
navigation: {
nextEl: ".array-next",
prevEl: ".array-prev",
},
pagination: {
el: ".dot2",
clickable: true,
},
});
var thumbs = new Swiper ('.testimonial-thumbs', {
slidesPerView: 3,
spaceBetween: 0,
centeredSlides: true,
loop: true,
speed: 1300,
slideToClickedSlide: true,
});
slider.controller.control = thumbs;
thumbs.controller.control = slider;
}
if ($('.testimonial-slider-2').length > 0) {
const testimonialSlider2 = new Swiper(".testimonial-slider-2", {
spaceBetween: 30,
speed: 1300,
loop: true,
centeredSlides: true,
autoplay: {
delay: 2000,
disableOnInteraction: false,
},
navigation: {
nextEl: ".array-next",
prevEl: ".array-prev",
},
pagination: {
el: ".dot2",
clickable: true,
},
breakpoints: {
1199: {
slidesPerView: 2.1,
},
991: {
slidesPerView: 1.9,
},
767: {
slidesPerView: 1.8,
},
575: {
slidesPerView: 1.1,
},
0: {
slidesPerView: 1,
},
},
});
}
if ($('.testimonial-slider-3').length > 0) {
const testimonialSlider3 = new Swiper(".testimonial-slider-3", {
spaceBetween: 30,
speed: 1300,
loop: true,
centeredSlides: true,
autoplay: {
delay: 2000,
disableOnInteraction: false,
},
navigation: {
nextEl: ".array-next",
prevEl: ".array-prev",
},
pagination: {
el: ".dot2",
clickable: true,
},
breakpoints: {
1399: {
slidesPerView: 4,
},
1199: {
slidesPerView: 3.4,
},
991: {
slidesPerView: 3,
},
767: {
slidesPerView: 2,
},
575: {
slidesPerView: 1.5,
},
0: {
slidesPerView: 1.2,
},
},
});
}
if ($('.expertise-slider').length > 0) {
const expertiseSlider = new Swiper(".expertise-slider", {
spaceBetween: 30,
speed: 1300,
loop: true,
autoplay: {
delay: 3000,
disableOnInteraction: false,
},
navigation: {
nextEl: ".array-next",
prevEl: ".array-prev",
},
pagination: {
el: ".dot-expertise",
clickable: true,
},
breakpoints: {
1399: {
slidesPerView: 3,
},
1199: {
slidesPerView: 3,
},
991: {
slidesPerView: 2,
},
767: {
slidesPerView: 2,
},
575: {
slidesPerView: 1.5,
},
0: {
slidesPerView: 1.2,
},
},
});
}
if ($('.testimonial-slider-4').length > 0) {
const testimonialSlider4 = new Swiper(".testimonial-slider-4", {
spaceBetween: 30,
speed: 1300,
loop: true,
autoplay: {
delay: 2000,
disableOnInteraction: false,
},
navigation: {
nextEl: ".array-next",
prevEl: ".array-prev",
},
pagination: {
el: ".dot2",
clickable: true,
},
breakpoints: {
1399: {
slidesPerView: 4,
},
1199: {
slidesPerView: 3,
},
991: {
slidesPerView: 2.4,
},
767: {
slidesPerView: 1.3,
},
575: {
slidesPerView: 1.3,
},
0: {
slidesPerView: 1.2,
},
},
});
}
if ($('.testimonial-slider-5').length > 0) {
const testimonialSlider5 = new Swiper(".testimonial-slider-5", {
spaceBetween: 30,
speed: 1300,
loop: true,
autoplay: {
delay: 2000,
disableOnInteraction: false,
},
navigation: {
nextEl: ".array-next",
prevEl: ".array-prev",
},
pagination: {
el: ".dot2",
clickable: true,
},
breakpoints: {
1199: {
slidesPerView: 3,
},
991: {
slidesPerView: 3,
},
767: {
slidesPerView: 2,
},
575: {
slidesPerView: 1.5,
},
0: {
slidesPerView: 1.2,
},
},
});
}
/* ================================
Global Service Box Js Start
================================ */
if (document.querySelectorAll(".global-service-box").length) {
const globalServiceBoxes = document.querySelectorAll(".global-service-box");
globalServiceBoxes.forEach((box) => {
const hoverImg = box.querySelector(".hover-image");
if (!hoverImg) return;
box.addEventListener("mousemove", (event) => {
const rect = box.getBoundingClientRect();
const x = event.clientX - rect.left;
const y = event.clientY - rect.top;
hoverImg.style.opacity = "1";
hoverImg.style.visibility = "visible";
hoverImg.style.transform = `translate(${x}px, ${y}px) rotate(10deg)`;
});
box.addEventListener("mouseleave", () => {
hoverImg.style.opacity = "0";
hoverImg.style.visibility = "hidden";
hoverImg.style.transform = `translateY(-50%) rotate(10deg)`;
});
});
}
/* ================================
Custom Accordion Js Start
================================ */
if ($('.accordion-box').length) {
$(".accordion-box").on('click', '.acc-btn', function () {
var outerBox = $(this).closest('.accordion-box');
var target = $(this).closest('.accordion');
var accBtn = $(this);
var accContent = accBtn.next('.acc-content');
if (target.hasClass('active-block')) {
// Already open, so close it
accBtn.removeClass('active');
target.removeClass('active-block');
accContent.slideUp(300);
} else {
// Close all others
outerBox.find('.accordion').removeClass('active-block');
outerBox.find('.acc-btn').removeClass('active');
outerBox.find('.acc-content').slideUp(300);
// Open clicked one
accBtn.addClass('active');
target.addClass('active-block');
accContent.slideDown(300);
}
});
}
if ($('.service-box-style-4').length) {
$(".service-box-style-4").on('click', '.service-acc-btn', function () {
var outerBox = $(this).closest('.service-box-style-4');
var target = $(this).closest('.accordion');
var accBtn = $(this);
var accContent = accBtn.next('.service-acc-content');
if (target.hasClass('active-block')) {
// Already open, so close it
accBtn.removeClass('active');
target.removeClass('active-block');
accContent.slideUp(300);
} else {
// Close all others
outerBox.find('.accordion').removeClass('active-block');
outerBox.find('.service-acc-btn').removeClass('active');
outerBox.find('.service-acc-content').slideUp(300);
// Open clicked one
accBtn.addClass('active');
target.addClass('active-block');
accContent.slideDown(300);
}
});
}
/* ================================
Mouse Cursor Animation Js Start
================================ */
if ($(".mouseCursor").length > 0) {
function itCursor() {
var myCursor = jQuery(".mouseCursor");
if (myCursor.length) {
if ($("body")) {
const e = document.querySelector(".cursor-inner"),
t = document.querySelector(".cursor-outer");
let n, i = 0, o = !1;
window.onmousemove = function(s) {
if (!o) {
t.style.transform = "translate(" + s.clientX + "px, " + s.clientY + "px)";
}
e.style.transform = "translate(" + s.clientX + "px, " + s.clientY + "px)";
n = s.clientY;
i = s.clientX;
};
$("body").on("mouseenter", "button, a, .cursor-pointer", function() {
e.classList.add("cursor-hover");
t.classList.add("cursor-hover");
});
$("body").on("mouseleave", "button, a, .cursor-pointer", function() {
if (!($(this).is("a", "button") && $(this).closest(".cursor-pointer").length)) {
e.classList.remove("cursor-hover");
t.classList.remove("cursor-hover");
}
});
e.style.visibility = "visible";
t.style.visibility = "visible";
}
}
}
itCursor();
}
/* ================================
Back To Top Button Js Start
================================ */
$windowOn.on('scroll', function() {
var windowScrollTop = $(this).scrollTop();
var windowHeight = $(window).height();
var documentHeight = $(document).height();
if (windowScrollTop + windowHeight >= documentHeight - 10) {
$("#back-top").addClass("show");
} else {
$("#back-top").removeClass("show");
}
});
$documentOn.on('click', '#back-top', function() {
$('html, body').animate({ scrollTop: 0 }, 800);
return false;
});
/* ================================
Search Popup Toggle Js Start
================================ */
if ($(".search-toggler").length) {
$(".search-toggler").on("click", function(e) {
e.preventDefault();
$(".search-popup").toggleClass("active");
$("body").toggleClass("locked");
});
}
/* ================================
Smooth Scroller And Title Animation Js Start
================================ */
if ($('#smooth-wrapper').length && $('#smooth-content').length) {
gsap.registerPlugin(ScrollTrigger, ScrollSmoother, SplitText);
gsap.config({
nullTargetWarn: false,
});
let smoother = ScrollSmoother.create({
wrapper: "#smooth-wrapper",
content: "#smooth-content",
smooth: 2,
effects: true,
smoothTouch: 0.1,
normalizeScroll: false,
ignoreMobileResize: true,
});
// Fonction pour scroller vers une ancre
function scrollToAnchor(hash, animate = true) {
const target = $(hash);
if (target.length) {
// Utiliser scrollTo de ScrollSmoother pour un défilement fluide
smoother.scrollTo(target[0], animate, `top 100px`);
}
}
// Gestion du hash au chargement de la page
if (window.location.hash) {
// Empêcher le scroll par défaut du navigateur
if ('scrollRestoration' in history) {
history.scrollRestoration = 'manual';
}
// Scroller vers l'ancre après un court délai pour s'assurer que tout est chargé
const hash = window.location.hash;
// Attendre que ScrollTrigger soit complètement rafraîchi
ScrollTrigger.addEventListener("refresh", function onRefresh() {
setTimeout(function() {
scrollToAnchor(hash, false); // false = scroll instantané au chargement
}, 1000);
ScrollTrigger.removeEventListener("refresh", onRefresh);
});
}
// Gestion des clics sur les liens ancres
$documentOn.on("click", "a[href^='#']:not([href='#'])", function(e) {
const hash = $(this).attr("href");
if ($(hash).length) {
e.preventDefault();
scrollToAnchor(hash, true);
}
});
}
/* ================================
Text Invert Js Start
================================ */
const split2 = new SplitText(".text_invert-2", { type: "lines" });
split2.lines.forEach((target) => {
gsap.to(target, {
backgroundPositionX: 0,
ease: "none",
scrollTrigger: {
trigger: target,
scrub: 1,
start: 'top 85%',
end: "bottom center",
}
});
});
if($('.tz-sub-tilte').length) {
var agtsub = $(".tz-sub-tilte");
if(agtsub.length == 0) return; gsap.registerPlugin(SplitText); agtsub.each(function(index, el) {
el.split = new SplitText(el, {
type: "lines,words,chars",
linesClass: "split-line"
});
if( $(el).hasClass('tz-sub-anim') ){
gsap.set(el.split.chars, {
opacity: 0,
x: "7",
});
}
el.anim = gsap.to(el.split.chars, {
scrollTrigger: {
trigger: el,
start: "top 90%",
end: "top 60%",
markers: false,
scrub: 1,
},
x: "0",
y: "0",
opacity: 1,
duration: .7,
stagger: 0.2,
});
});
}
if($('.tz-itm-title').length) {
var txtheading = $(".tz-itm-title");
if(txtheading.length == 0) return; gsap.registerPlugin(SplitText); txtheading.each(function(index, el) {
el.split = new SplitText(el, {
type: "lines,words,chars",
linesClass: "split-line"
});
if( $(el).hasClass('tz-itm-anim') ){
gsap.set(el.split.chars, {
opacity: .3,
x: "-7",
});
}
el.anim = gsap.to(el.split.chars, {
scrollTrigger: {
trigger: el,
start: "top 92%",
end: "top 60%",
markers: false,
scrub: 1,
},
x: "0",
y: "0",
opacity: 1,
duration: .7,
stagger: 0.2,
});
});
}
/* ================================
Text Anim Js Start
================================ */
if ($(".text-anim").length) {
let staggerAmount = 0.03,
translateXValue = 20,
delayValue = 0.1,
easeType = "power2.out",
animatedTextElements = document.querySelectorAll(".text-anim");
animatedTextElements.forEach(element => {
let animationSplitText = new SplitText(element, { type: "chars, words" });
// ScrollTrigger দিয়ে section এ ঢুকলে animation শুরু হবে
ScrollTrigger.create({
trigger: element,
start: "top 85%",
onEnter: () => {
gsap.from(animationSplitText.chars, {
duration: 1,
delay: delayValue,
x: translateXValue,
autoAlpha: 0,
stagger: staggerAmount,
ease: easeType,
});
},
});
});
}
}); // End Document Ready Function
/* ================================
Pricing Toggle Js Start
================================ */
document.addEventListener("DOMContentLoaded", () => {
const monthlyBtn = document.querySelector(".monthly-label");
const yearlyBtn = document.querySelector(".yearly-label");
const prices = document.querySelectorAll(".price");
// Only run if the page has the pricing elements
if (!monthlyBtn || !yearlyBtn || prices.length === 0) return;
let isAnimating = false;
function changePrice(type) {
if (isAnimating) return; // Prevent double click bug
isAnimating = true;
prices.forEach(price => {
price.classList.add("fade-out");
setTimeout(() => {
const value = price.dataset[type];
const period = type === "monthly" ? "months" : "year";
price.innerHTML = `$${value}/ ${period}`;
price.classList.remove("fade-out");
price.classList.add("fade-in");
setTimeout(() => {
price.classList.remove("fade-in");
isAnimating = false;
}, 300);
}, 300);
});
}
monthlyBtn.addEventListener("click", function () {
if (!this.classList.contains("active")) {
monthlyBtn.classList.add("active");
yearlyBtn.classList.remove("active");
changePrice("monthly");
}
});
yearlyBtn.addEventListener("click", function () {
if (!this.classList.contains("active")) {
yearlyBtn.classList.add("active");
monthlyBtn.classList.remove("active");
changePrice("yearly");
}
});
});
/* ================================
Preloader Js Start
================================ */
function loader() {
$(window).on('load', function() {
// Animate loader off screen
$(".preloader").addClass('loaded');
$(".preloader").delay(600).fadeOut();
});
}
loader();
})(jQuery); // End jQuery