window.onload = function() {
    $('.global-container').addClass('is-loader');
    $('.slick-slider').addClass('is-loader');

};


AOS.init({
    once: true
});


$(document).ready(function () {
    var siteHeader = $('.site-header').height();
    $(window).scroll(function () {
        if ($(this).scrollTop() > siteHeader + 200) {
            $('.site-header').addClass('tiny');
        } else {
            $('.site-header').removeClass('tiny');
        }
    });

    $('[data-toggle="menu-sidebar"]').click(function(){
        $(this).toggleClass('close');
        $('.site-header .main-wrapper').toggleClass('open');
    });

    $('[data-toggle="close-menu-sidebar"]').click(function(){
        $('[data-toggle="menu-sidebar"]').removeClass('close');
        $('.site-header .main-wrapper').removeClass('open');
        $('.propduct-nav').removeClass('open');
    });

    $('[data-toggle="menu-category"]').click(function(){
        $('.propduct-nav').toggleClass('open');
    });

    $('.select-control').select2({
        minimumResultsForSearch: Infinity,
        placeholder: "Select"
    });
    $('.select-control.has-search').select2({
        placeholder: "Select"
    });

    $(".mcscroll").mCustomScrollbar({
        axis : "y",
        scrollButtons: {
            enable: true
        }
    });
    $(".mcscrollX").mCustomScrollbar({
        axis : "x",
        scrollButtons: {
            enable: true
        }
    });

    $('[data-fancybox]').fancybox({
        buttons: [
            //"zoom",
            //"share",
            "slideShow",
            //"fullScreen",
            //"download",
            //"thumbs",
            "close"
        ],
        animationEffect: "zoom-in-out",
        animationDuration: 600,
        transitionEffect: "circular",
        transitionDuration: 600
    });

    $('.footer-nav .slider').slick({
        prevArrow:"<a class='slick-prev'><span class='feather icon-chevron-left'></span></a>",
        nextArrow:"<a class='slick-next'><span class='feather icon-chevron-right'></span></a>",
        fade: false,
        autoplay: false,
        autoplaySpeed: 5000,
        speed: 800,
        infinite: false,
        arrows: true,
        dots: false,
        pauseOnHover: false,
        centerMode: false,
        slidesToShow: 3,
        focusOnSelect: true
    });

    $('.wg-nav-list .slider').slick({
        prevArrow:"<a class='slick-prev'><span class='feather icon-chevron-left'></span></a>",
        nextArrow:"<a class='slick-next'><span class='feather icon-chevron-right'></span></a>",
        fade: false,
        autoplay: false,
        autoplaySpeed: 5000,
        speed: 800,
        infinite: false,
        arrows: true,
        dots: false,
        pauseOnHover: false,
        centerMode: false,
        slidesToShow: 3,
        focusOnSelect: true,
        responsive: [
            {
                breakpoint: 767,
                settings: {
                    arrows: false,
                    slidesToShow: 1,
                    variableWidth: true
                }
            },
            {
                breakpoint: 992,
                settings: {
                    arrows: false,
                    slidesToShow: 2,
                    variableWidth: true
                }
            }
        ]
    });
    
    $('.default-nav-list .slider').slick({
        prevArrow:"<a class='slick-prev'><span class='feather icon-chevron-left'></span></a>",
        nextArrow:"<a class='slick-next'><span class='feather icon-chevron-right'></span></a>",
        fade: false,
        autoplay: false,
        autoplaySpeed: 5000,
        speed: 1000,
        infinite: true,
        arrows: true,
        dots: false,
        pauseOnHover: false,
        centerMode: false,
        slidesToShow: 4,
        focusOnSelect: false,
        responsive: [
            {
                breakpoint: 767,
                settings: {
                    arrows: false,
                    slidesToShow: 3,
                    variableWidth: true
                }
            },
            {
                breakpoint: 992,
                settings: {
                    arrows: false,
                    slidesToShow: 3
                }
            }
        ]
    });

    // btn-policy
    $('.btn-policy').click(function(){
        $('.btn-policy').removeClass('active')
        $(this).addClass('active')
    });
});

(function($) {
    "use strict"; // Start of use strict
  
    // Smooth scrolling using jQuery easing
    $('a.js-scroll-trigger[href*="#"]:not([href="#"])').click(function() {
      if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
        var target = $(this.hash);
        var topbar = $('.site-header').height();
        target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
        if (target.length) {
          $('html, body').animate({
            scrollTop: (target.offset().top - topbar)
          }, 1000, "easeInOutExpo");
          return false;
        }
      }
    });
})(jQuery); // End of use strict