/home/moonrcjl/template.moontelict.com/a.laxfy/assets/js/main.js
(function ($) {
  "use strict";


  var windowOn = $(window);

  windowOn.on('load', function () {
    wowAnimation();
  });

  ////////////////////////////////////////////////////
  // 1. preloader Js
  windowOn.on('load', function () {
    $("#loading").fadeOut(500);
  })

  ////////////////////////////////////////////////////
  // 2. Back-to-top Js
  var btn = $('#back-to-top');
  windowOn.scroll(function () {
    if (windowOn.scrollTop() > 300) {
      btn.addClass('show');
    } else {
      btn.removeClass('show');
    }
  });
  btn.on('click', function () {
    $('html, body').animate({ scrollTop: 0 }, '300');
  });

  ////////////////////////////////////////////////////
  // 3. Sticky Js
  windowOn.on('scroll', function () {
    var scroll = windowOn.scrollTop();
    if (scroll < 100) {
      $("#mt-header-sticky").removeClass("mtheader-sticky");
    } else {
      $("#mt-header-sticky").addClass("mtheader-sticky");
    }
  });

  ////////////////////////////////////////////////////
  // 4. Offcanvas Js
  $(".mt-offcanvas-toggle").on('click', function () {
    $(".mt-offcanvas").addClass("mt-offcanvas-open");
    $(".mt-offcanvas-overlay").addClass("mt-offcanvas-overlay-open");
  });
  $(".mt-offcanvas-close-toggle,.mt-offcanvas-overlay").on('click', function () {
    $(".mt-offcanvas").removeClass("mt-offcanvas-open");
    $(".mt-offcanvas-overlay").removeClass("mt-offcanvas-overlay-open");
  });

  ////////////////////////////////////////////////////
  // 5. Search Js
  $(".mt-search-toggle").on('click', function () {
    $(".mt-header-search-bar").addClass("mt-search-open");
    $(".mt-offcanvas-overlay").addClass("mt-offcanvas-overlay-open");
  });
  $(".mt-search-close,.mt-offcanvas-overlay").on('click', function () {
    $(".mt-header-search-bar").removeClass("mt-search-open");
    $(".mt-offcanvas-overlay").removeClass("mt-offcanvas-overlay-open");
  });

  ////////////////////////////////////////////////////
  // 6. Mini Cart Js
  $('.mt-cart-toggle').on('click', function () {
    $('.mtcartmini__area').addClass('mtcartmini-opened');
    $('.mt-offcanvas-overlay').addClass('mt-offcanvas-overlay-open');
  });
  $('.mtcartmini-close-btn,.mt-offcanvas-overlay').on('click', function () {
    $('.mtcartmini__area').removeClass('mtcartmini-opened');
    $('.mt-offcanvas-overlay').removeClass('mt-offcanvas-overlay-open');
  });

  ////////////////////////////////////////////////////
  // 7. Background Js
  $("[data-background]").each(function () {
    $(this).css("background-image", "url(" + $(this).attr("data-background") + ")")
  })

  // data bg color
  $("[data-bg-color]").each(function () {
    $(this).css("background-color", $(this).attr("data-bg-color"))
  })

  // data color
  $("[data-color]").each(function () {
    $(this).css("color", $(this).attr("data-color"))
  })

  ////////////////////////////////////////////////////
  // 8. Popup Js
  $('.popup-image').magnificPopup({
    type: 'image'
    // other options
  });
  $('.popup-video').magnificPopup({
    type: 'iframe'
    // other options
  });

  ////////////////////////////////////////////////////
  // 9. Variable Active Item  Js
  $('.mt-shop-details__color ul li ').on('mouseenter', function () {
    $('ul li ').removeClass('active');
    $(this).addClass('active');
  });

  $('.mt-shop-details__size ul li ').on('mouseenter', function () {
    $('ul li ').removeClass('active');
    $(this).addClass('active');
  });

  ////////////////////////////////////////////////////
  // 10. grid active Js
  if ($('.grid').length != 0) {
    var $grid = $('.grid').imagesLoaded(function () {
      $('.grid').isotope({
        itemSelector: '.grid-item',
        percentPosition: true,
        masonry: {
          columnWidth: 1
        }
      })

      // filter items on button click
      $('.mt-portfolio-filter').on('click', 'button', function () {
        var filterValue = $(this).attr('data-filter');
        $grid.isotope({ filter: filterValue });
      });
      //for menu active class
      $('.mt-portfolio-filter button').on('click', function (event) {
        $(this).siblings('.active').removeClass('active');
        $(this).addClass('active');
        event.preventDefault();
      });
    });
  }

  ////////////////////////////////////////////////////
  // 11. Project Hover Js
  const getSlide = $('.mt-hero-img-item, .mt-hero-img img').length - 1;
  const slideCal = 100 / getSlide + '%';

  $('.mt-hero-img img').css({
    "width": slideCal
  });

  $('.mt-hero-img img').hover(function () {
    $('.mt-hero-img img').removeClass('active');
    $(this).addClass('active');
  });

  ////////////////////////////////////////////////////
  // 12. Team Hover Js
  const getTeam = $('.mt-team-item, .mt-team-img img').length - 1;
  const slideTeam = 100 / getTeam + '%';

  $('.mt-team-img img').css({
    "width": slideTeam
  });

  $('.mt-team-img img').hover(function () {
    $('.mt-team-img img').removeClass('active');
    $(this).addClass('active');
  });
  
  ////////////////////////////////////////////////////
  // 01. Swiper Js
  var swiper = new Swiper(".mt-blog-active", {
    slidesPerView: 1,
    spaceBetween: 0,
    keyboard: {
      enabled: true,
    },
    pagination: {
      el: ".swiper-pagination",
      clickable: true,
    },
    navigation: {
      nextEl: ".mt-swiper-blog-button-next",
      prevEl: ".mt-swiper-blog-button-prev",
    },
  });

  ////////////////////////////////////////////////////
  // 02. Swiper Js
  var swiper = new Swiper('.mt-slider-3-active', {
    // Optional parameters
    speed: 1000,
    loop: true,
    slidesPerView: 3,
    autoplay: true,
    spaceBetween: 30,
    breakpoints: {
      '1600': {
        slidesPerView: 1,
      },
      '1400': {
        slidesPerView: 1,
      },
      '1200': {
        slidesPerView: 1,
      },
      '992': {
        slidesPerView: 1,
      },
      '768': {
        slidesPerView: 1,
      },
      '576': {
        slidesPerView: 1,
      },
      '0': {
        slidesPerView: 1,
      },

      a11y: false,
    },
    // Navigation arrows
    navigation: {
      nextEl: '.mt-slider-3-prev',
      prevEl: '.mt-slider-3-next',
    },
    pagination: {
      el: ".mt-slider-3-dots",
      clickable: true,
    },
  });

  ////////////////////////////////////////////////////
  // 03. Swiper Js
  var swiper = new Swiper(".mt-service-active", {
    slidesPerView: 1,
    spaceBetween: 30,
    keyboard: {
      enabled: true,
    },
    pagination: {
      el: ".mt-service-pagination",
      clickable: true,
    },
    breakpoints: {
      0: {
        slidesPerView: 1,
      },
      768: {
        slidesPerView: 1,
      },
      992: {
        slidesPerView: 2,
      },
      1200: {
        slidesPerView: 3,
      }
    },
  });

  ////////////////////////////////////////////////////
  // 04. Swiper Js
  var swiper = new Swiper(".mt-service-active8", {
    slidesPerView: 1,
    spaceBetween: 30,
    keyboard: {
      enabled: true,
    },
    pagination: {
      el: ".mt-service-pagination",
      clickable: true,
    },
    breakpoints: {
      0: {
        slidesPerView: 1,
      },
      768: {
        slidesPerView: 2,
      },
      992: {
        slidesPerView: 2,
      },
      1200: {
        slidesPerView: 3,
      }
    },
  });

  ////////////////////////////////////////////////////
  // 05. Swiper Js
  var swiper = new Swiper(".mt-service-7-active", {
    slidesPerView: 1,
    spaceBetween: 20,
    keyboard: {
      enabled: true,
    },
    pagination: {
      el: ".mt-service-pagination",
      clickable: true,
    },
    breakpoints: {
      0: {
        slidesPerView: 1,
      },
      768: {
        slidesPerView: 2,
      },
      992: {
        slidesPerView: 3,
      },
      1200: {
        slidesPerView: 3,
      },
      1600: {
        slidesPerView: 5,
      },
      1800: {
        slidesPerView: 6,
      }
    },
  });
  ////////////////////////////////////////////////////
  // 06. Swiper Js
  var swiper = new Swiper(".mt-service-8-active", {
    slidesPerView: 1,
    spaceBetween: 20,
    keyboard: {
      enabled: true,
    },
    pagination: {
      el: ".mt-service-dots",
      clickable: true,
    },
    breakpoints: {
      0: {
        slidesPerView: 1,
      },
      768: {
        slidesPerView: 2,
      },
      992: {
        slidesPerView: 2,
      },
      1200: {
        slidesPerView: 3,
      },
    },
  });

  ////////////////////////////////////////////////////
  // 07. Swiper Js
  var swiper = new Swiper(".mt-brand-top-active", {
    slidesPerView: 'auto',
    spaceBetween: 80,
    freemode: true,
    centeredSlides: true,
    loop: true,
    speed: 4000,
    allowTouchMove: false,
    autoplay: {
      delay: 1,
      disableOnInteraction: true,
    },
  });

  ////////////////////////////////////////////////////
  // 08. Swiper Js
  var swiper = new Swiper('.mt-brand-2-active', {
    // Optional parameters
    speed: 1000,
    loop: true,
    slidesPerView: 3,
    autoplay: true,
    spaceBetween: 30,
    breakpoints: {
      '1600': {
        slidesPerView: 7,
      },
      '1400': {
        slidesPerView: 7,
      },
      '1200': {
        slidesPerView: 5,
      },
      '992': {
        slidesPerView: 4,
      },
      '768': {
        slidesPerView: 3,
      },
      '576': {
        slidesPerView: 2,
      },
      '0': {
        slidesPerView: 2,
      },

      a11y: false,
    },
    // Navigation arrows
    navigation: {
      nextEl: '.blog-4-prev',
      prevEl: '.blog-4-next',
    },
  });


  ////////////////////////////////////////////////////
  // 09. Swiper Js
  var swiper = new Swiper(".mt-testimonial-vertical-active", {
    slidesPerView: 1,
    spaceBetween: 30,
    keyboard: {
      enabled: true,
    },
    navigation: {
      nextEl: ".mt-swiper-test-button-next",
      prevEl: ".mt-swiper-test-button-prev",
    },
  });

  ////////////////////////////////////////////////////
  // 10. Swiper Js 
  var swiper = new Swiper(".mt-testimonial-6-active", {
    slidesPerView: 1,
    spaceBetween: 30,
    keyboard: {
      enabled: true,
    },
    breakpoints: {
      0: {
        slidesPerView: 1,
      },
      768: {
        slidesPerView: 2,
      },
      992: {
        slidesPerView: 2,
      },
      1200: {
        slidesPerView: 2,
      }
    },
    navigation: {
      nextEl: ".mt-testimonial-next",
      prevEl: ".mt-testimonial-prev",
    },
  });

  ////////////////////////////////////////////////////
  // 11. Swiper Js 
  var swiper = new Swiper(".mt-testimonial-8-active", {
    slidesPerView: 1,
    spaceBetween: 30,
    keyboard: {
      enabled: true,
    },
    breakpoints: {
      0: {
        slidesPerView: 1,
      },
      768: {
        slidesPerView: 1,
      },
      992: {
        slidesPerView: 1,
      },
      1200: {
        slidesPerView: 1,
      }
    },
    navigation: {
      nextEl: ".mt-testimonial-next",
      prevEl: ".mt-testimonial-prev",
    },
  });
  ////////////////////////////////////////////////////
  // 12. Swiper Js 
  var swiper = new Swiper(".mt-testimonial-9-active", {
    slidesPerView: 1,
    spaceBetween: 30,
    keyboard: {
      enabled: true,
    },
    breakpoints: {
      0: {
        slidesPerView: 1,
      },
      768: {
        slidesPerView: 2,
      },
      992: {
        slidesPerView: 3,
      },
      1200: {
        slidesPerView: 3,
      }
    },
    pagination: {
      el: ".mt-testimonial-dots",
      clickable: true,
    },
  });

  ////////////////////////////////////////////////////
  // 13. Swiper Js 
  var swiper = new Swiper(".mt-testimonial-7-active", {
    slidesPerView: 2,
    spaceBetween: 30,
    keyboard: {
      enabled: true,
    },
    loop: true,
    breakpoints: {
      0: {
        slidesPerView: 1,
      },
      768: {
        slidesPerView: 1,
      },
      992: {
        slidesPerView: 2,
      },
      1200: {
        slidesPerView: 3,
      }
    },
    pagination: {
      el: ".mt-testimonial-pagination",
      clickable: true,
    },
  });

  ////////////////////////////////////////////////////
  // 14. Swiper Js 
  var swiper = new Swiper(".mt-testimonial-5-active", {
    slidesPerView: 1,
    spaceBetween: 30,
    keyboard: {
      enabled: true,
    },
    pagination: {
      el: ".swiper-pagination",
      clickable: true,
    },
    navigation: {
      nextEl: ".mt-testimonial-5-next",
      prevEl: ".mt-testimonial-5-prev",
    },
  });

  ////////////////////////////////////////////////////
  // 15. Swiper Js
  var swiper = new Swiper(".mttestimonial__active", {
    slidesPerView: 1,
    spaceBetween: 30,
    keyboard: {
      enabled: true,
    },
    pagination: {
      el: ".mttestimonial__dots",
      clickable: true,
    },
    navigation: {
      nextEl: ".mttestimonial-button-next",
      prevEl: ".mttestimonial-button-prev",
    },
  });

  ////////////////////////////////////////////////////
  // 16. Swiper Js
  var swiper = new Swiper(".mtscreenshort__active", {
    effect: "coverflow",
    grabCursor: true,
    centeredSlides: true,
    slidesPerView: "auto",
    spaceBetween: 20,
    freemode: true,
    loop: true,
    speed: 3000,
    coverflowEffect: {
      rotate: 25,
      stretch: 0,
      depth: 50,
      modifier: 1,
      slideShadows: true,
    },
    breakpoints: {
      0: {
        slidesPerView: 2,
      },
      768: {
        slidesPerView: 2,
      },
      992: {
        slidesPerView: 2,
      },
      1200: {
        slidesPerView: 3,
      }
    },
    pagination: {
      el: ".mteffect-pagination",
      clickable: true,
    },
    navigation: {
      nextEl: ".mtscreenshort-button-next",
      prevEl: ".mtscreenshort-button-prev",
    },
  });

  ////////////////////////////////////////////////////
  // 17. Swiper Js
  var swiper = new Swiper(".mt-testimonial-3-active", {
    speed: 1000,
    loop: true,
    slidesPerView: 3,
    autoplay: true,
    spaceBetween: 20,

    breakpoints: {
      0: {
        slidesPerView: 1,
      },
      768: {
        slidesPerView: 2,
      },
      992: {
        slidesPerView: 3,
      },
      1200: {
        slidesPerView: 3,
      }
    },

    navigation: {
      nextEl: ".mt-testimonial-3-next",
      prevEl: ".mt-testimonial-3-prev",
    },
  });

  ////////////////////////////////////////////////////
  // 18. Swiper Js
  var swiper = new Swiper(".mt-brand-5-active", {
    slidesPerView: 'auto',
    spaceBetween: 30,
    freemode: true,
    centeredSlides: true,
    loop: true,
    speed: 9000,
    allowTouchMove: false,
    autoplay: {
      delay: 1,
      disableOnInteraction: true,
    },
  });

  ////////////////////////////////////////////////////
  // 19. Swiper Js
  var swiper = new Swiper('.mt-blog-6-active', {
    // Optional parameters
    speed: 1000,
    loop: true,
    slidesPerView: 3,
    autoplay: true,
    spaceBetween: 30,
    breakpoints: {
      '1200': {
        slidesPerView: 3,
      },
      '992': {
        slidesPerView: 2,
      },
      '768': {
        slidesPerView: 1,
      },
      '576': {
        slidesPerView: 1,
      },
      '0': {
        slidesPerView: 1,
      },

      a11y: false,
    },
    // Navigation arrows
    navigation: {
      nextEl: '.mt-blog-6-button-next',
      prevEl: '.mt-blog-6-button-prev',
    },
  });

  ////////////////////////////////////////////////////
  // 20. Swiper Js
  var swiper = new Swiper('.mt-blog-4-active', {
    // Optional parameters
    speed: 1000,
    loop: true,
    slidesPerView: 3,
    autoplay: true,
    spaceBetween: 30,
    breakpoints: {
      '1600': {
        slidesPerView: 3,
      },
      '1400': {
        slidesPerView: 3,
      },
      '1200': {
        slidesPerView: 3,
      },
      '992': {
        slidesPerView: 2,
      },
      '768': {
        slidesPerView: 2,
      },
      '576': {
        slidesPerView: 1,
      },
      '0': {
        slidesPerView: 1,
      },

      a11y: false,
    },
    // Navigation arrows
    navigation: {
      nextEl: '.blog-4-prev',
      prevEl: '.blog-4-next',
    },
  });

  ////////////////////////////////////////////////////
  // 21. Swiper Js
  var swiper = new Swiper('.mt-project-active', {
    // Optional parameters
    speed: 1000,
    loop: true,
    slidesPerView: 3,
    autoplay: true,
    spaceBetween: 30,
    breakpoints: {
      '1600': {
        slidesPerView: 3,
      },
      '1400': {
        slidesPerView: 3,
      },
      '1200': {
        slidesPerView: 3,
      },
      '992': {
        slidesPerView: 3,
      },
      '768': {
        slidesPerView: 2,
      },
      '576': {
        slidesPerView: 1,
      },
      '0': {
        slidesPerView: 1,
      },

      a11y: false,
    },
    // Navigation arrows
    navigation: {
      nextEl: '.mt-project-next',
      prevEl: '.mt-project-prev',
    },
  });

  ////////////////////////////////////////////////////
  // 22. Swiper Js
  var swiper = new Swiper('.mt-esports_active', {
    // Optional parameters
    speed: 1000,
    loop: true,
    slidesPerView: 3,
    autoplay: true,
    spaceBetween: 15,
    breakpoints: {
      '1200': {
        slidesPerView: 3,
      },
      '992': {
        slidesPerView: 2,
      },
      '768': {
        slidesPerView: 2,
      },
      '0': {
        slidesPerView: 1,
      },

      a11y: false,
    },
    pagination: {
      el: ".mt-esports-dots",
      clickable: true,
    }
  });

  ////////////////////////////////////////////////////
  // 23. Swiper Js
  var swiper = new Swiper('.mt-project-active8', {
    // Optional parameters
    speed: 1000,
    loop: true,
    slidesPerView: 3,
    autoplay: true,
    spaceBetween: 0,
    breakpoints: {
      '1600': {
        slidesPerView: 5,
      },
      '1400': {
        slidesPerView: 5,
      },
      '1200': {
        slidesPerView: 4,
      },
      '992': {
        slidesPerView: 3,
      },
      '768': {
        slidesPerView: 2,
      },
      '576': {
        slidesPerView: 1,
      },
      '0': {
        slidesPerView: 1,
      },

      a11y: false,
    },
    pagination: {
      el: ".mt-project-pagination",
      clickable: true,
    },
    // Navigation arrows
    navigation: {
      nextEl: '.mt-project-next',
      prevEl: '.mt-project-prev',
    },
  });

  ////////////////////////////////////////////////////
  // 24. Swiper Js
  var swiper = new Swiper(".mt-brand-title-active", {
    slidesPerView: 'auto',
    spaceBetween: 80,
    freemode: true,
    centeredSlides: true,
    loop: true,
    speed: 4000,
    allowTouchMove: false,
    autoplay: {
      delay: 1,
      disableOnInteraction: true,
    },
  });

  ////////////////////////////////////////////////////
  // 25. Swiper Js
  var slider = new Swiper('.mt-slider-content-active', {
    slidesPerView: 1,
    centeredSlides: true,
    loop: false,
    loopedSlides: 3,
    pagination: {
      el: ".mt-slider-dots",
      clickable: true,
      renderBullet: function (index, className) {
        return '<span class="' + className + '">0' + (index + 1) + "</span>";
      },
    },

  });
  var thumbs = new Swiper('.mt-slider-thumb-active', {
    slidesPerView: 1,
    spaceBetween: 10,
    centeredSlides: true,
    loop: true,
    slideToClickedSlide: true,
  });

  slider.controller.control = thumbs;
  thumbs.controller.control = slider;

  ////////////////////////////////////////////////////
  // 13. Quantity Js 
  function mt_ecommerce() {
    $('.mt-cart-minus').on('click', function () {
      var $input = $(this).parent().find('input');
      var count = parseInt($input.val()) - 1;
      count = count < 1 ? 1 : count;
      $input.val(count);
      $input.change();
      return false;
    });

    $('.mt-cart-plus').on('click', function () {
      var $input = $(this).parent().find('input');
      $input.val(parseInt($input.val()) + 1);
      $input.change();
      return false;
    });

    $("#slider-range").slider({
      range: true,
      min: 0,
      max: 500,
      values: [75, 300],
      slide: function (event, ui) {
        $("#amount").val("$" + ui.values[0] + " - $" + ui.values[1]);
      }
    });
    $("#amount").val("$" + $("#slider-range").slider("values", 0) +
      " - $" + $("#slider-range").slider("values", 1));



    $('.mt-checkout-payment-item label').on('click', function () {
      $(this).siblings('.mt-checkout-payment-desc').slideToggle(400);

    });

    ////////////////////////////////////////////////////
    // 14. Create An Account Toggle Js
    $('#cbox').on('click', function () {
      $('#cbox_info').slideToggle(900);
    });

    ////////////////////////////////////////////////////
    // 15. Shipping Box Toggle Js
    $('#ship-box').on('click', function () {
      $('#ship-box-info').slideToggle(1000);
    });
  }
  mt_ecommerce();


  ////////////////////////////////////////////////////
  // 16. Mouse Cursor Js
  function mousecursor() {
    if ($("body")) {
      const e = document.querySelector(".cursor-inner"),
        t = document.querySelector(".cursor-outer");
      let n,
        i = 0,
        o = !1;
      (window.onmousemove = function (s) {
        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", "a, .cursor-pointer", function () {
          e.classList.add("cursor-hover");
          t.classList.add("cursor-hover");
        }),
        $("body").on("mouseleave", "a, .cursor-pointer", function () {
          ($(this).is("a") && $(this).closest(".cursor-pointer").length) ||
            (e.classList.remove("cursor-hover"),
              t.classList.remove("cursor-hover"));
        }),
        (e.style.visibility = "visible"),
        (t.style.visibility = "visible");
    }
  }
  $(function () {
    mousecursor();
  });


  ////////////////////////////////////////////////////
  // 17. Nice Select Js
  $('select').niceSelect();

  ////////////////////////////////////////////////////
  // 18. Counter Js
  new PureCounter();
  new PureCounter({
    filesizing: true,
    selector: ".filesizecount",
    pulse: 2,
  });

  ////////////////////////////////////////////////////
  // 19. Wow Js
  function wowAnimation() {
    var wow = new WOW({
      boxClass: 'wow',
      animateClass: 'animated',
      offset: 0,
      mobile: false,
      live: true
    });
    wow.init();
  }

  ////////////////////////////////////////////////////
  // 20. Jarallax Js
  if ($('.jarallax').length) {
    $('.jarallax').jarallax({
      speed: 0.2,
    });
  }

})(jQuery);