$( function() {

    var wind = $(window);

    wow = new WOW({
        boxClass: 'wow',
        animateClass: 'animated',
        offset: 200,
        mobile: false,
        live: false
    });
    wow.init();

    // ---------- background change -----------
    var pageSection = $(".bg-img");
    pageSection.each(function (indx) {

        if ($(this).attr("data-background")) {
            $(this).css("background-image", "url(" + $(this).data("background") + ")");
        }
    });


    // ----------- side menu -----------
    $(".side_menu_btn").on("click", function () {
        $(".fixed-menu").addClass("show");
    });

    $(".fixed-menu .clss").on("click", function () {
        $(".fixed-menu").removeClass("show");
    });


    // ---------- to top -----------

    wind.on("scroll", function() {

        var bodyScroll = wind.scrollTop(),
            toTop = $("#to_top")

        if (bodyScroll > 700) {

            toTop.addClass("show");

        } else {

            toTop.removeClass("show");
        }
    });

    $('#to_top').click(function() {
        $('html, body').animate({
            scrollTop: 0
        }, 0);
        return false;
    });


    // -------- counter --------
    $('.counter').countUp({
        delay: 10,
        time: 2000
    });

    // -------- fav-btn --------
    $(".fav-btn").on("click", function(){
        $(this).toggleClass("active");
    })

    // -------- cls --------
    $(".cls").on("click", function(){
        $(this).parent().fadeOut();
    })

    // ------------ working in desktop -----------
    // if ($(window).width() > 991) {
    //     $('.parallaxie').parallaxie({
    //     });
    // }

    // ---------- tooltip -----------
    var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
    var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
    return new bootstrap.Tooltip(tooltipTriggerEl)
    })
        
});



// ------------ swiper sliders -----------
$(document).ready(function () {

    // ------------ tc-header-slider1 -----------
    var imgSwiper = new Swiper('.fixed-menu .food-slider', {
        slidesPerView: "auto",
        spaceBetween: 50,
        centeredSlides: true,
        speed: 1500,
        pagination: {
            el: '.fixed-menu .swiper-pagination',
            clickable: true,
        },
        navigation: {
            nextEl: '.fixed-menu .swiper-button-next',
            prevEl: '.fixed-menu .swiper-button-prev',
        },
        mousewheel: false,
        keyboard: true,
        autoplay: {
            delay: 5000,
            disableOnInteraction: false,
            pauseOnMouseEnter: false,
        },
        loop: false,
        allowTouchMove: false,
        grabCursor: false,
    });

    // ------------ tc-header-slider1 -----------
    var textSwiper = new Swiper('.fixed-menu .food-text-slider', {
        slidesPerView: 1,
        direction: 'vertical',
        spaceBetween: 50,
        centeredSlides: true,
        speed: 1500,
        pagination: false,
        navigation: {
            nextEl: '.fixed-menu .swiper-button-next',
            prevEl: '.fixed-menu .swiper-button-prev',
        },
        mousewheel: false,
        keyboard: true,
        autoplay: {
            delay: 5000,
            disableOnInteraction: false,
            pauseOnMouseEnter: false,
        },
        loop: false,
        allowTouchMove: false,
        grabCursor: false,
    });

    imgSwiper.controller.control = this.textSwiper;

});


// $(function () {
//     gsap.registerPlugin(ScrollTrigger, ScrollSmoother);

//     create the smooth scroller FIRST!
//     const smoother = ScrollSmoother.create({
//         content: "#scrollsmoother-container",
//         smooth: 1.5,
//         normalizeScroll: true,
//         ignoreMobileResize: true,
//         effects: true,
//         preventDefault: true,
//         ease: 'power4.out',
//         smoothTouch: 0.1, 
//     });

// });

  

