AOS.init({ once: true });

// custom-header-dropdown
$(document).on('click', '.nav-link', function (e) {
  console.log('here');
  if (window.matchMedia("(max-width: 991px)").matches) {
    if ($(this).closest('.nav-item').find('.dropdown').css('display') == 'none') {
      $('.dropdown').css("display", "none");
      $(this).closest('.nav-item').find('.dropdown').css("display", "block");
    } else {
      $('.dropdown').css("display", "none");
    }
  }
});
// custom-header-dropdown


// slider
$('#home-slider').owlCarousel({
  loop: true,
  margin: 10,
  animateOut: 'fadeOut',
  animateIn: 'fadeIn',
  nav: false,
  dots: false,
  autoplay: true,
  autoplaySpeed: 5000,
  autoplayTimeout: 5000,
  autoplayHoverPause: true,
  mouseDrag: false,
  smartSpeed: 250,
  margin: 0,
  navText: [
    '<i class="far fa-chevron-left" aria-hidden="true"></i>',
    '<i class="far fa-chevron-right" aria-hidden="true"></i>'
  ],
  responsiveClass: true,
  responsive: {
    0: {
      items: 1
    },
    575: {
      items: 1
    },
    767: {
      items: 1
    },
    991: {
      items: 1
    },
    1199: {
      items: 1
    },
    1399: {
      items: 1
    }
  }
});


var owl = $("#reviewSlider");
	owl.owlCarousel({
		autoplay: true,
		autoplayTimeout:2000,
		autoplayHoverPause: true,
		items: 3,
		loop: true,
		center: false,
		nav: false,
		margin: 0,
		responsive: {
			0: {
				items: 1
			},
			480: {
				items: 2,
			},
			768: {
				items: 2,
			},
			992: {
				items: 2,
		}
		},
	});


  
// slider

// //Scroll event
// $(window).scroll(function () {
//   var scrolled = $(window).scrollTop();
//   if (scrolled > 200) $('.go-top').fadeIn('slow');
//   if (scrolled < 200) $('.go-top').fadeOut('slow');
// });
// //Scroll event

window.addEventListener("scroll", function () {
  const header = document.getElementById("myHeader");
  if (window.scrollY > 100) {
    header.classList.add("sticky-header");
  } else {
    header.classList.remove("sticky-header");
  }
});

//Click event
$('.go-top').click(function () {
  $("html, body").animate({ scrollTop: "0" }, 500);
});
//Click event

// sticky-header
window.onscroll = function () { myFunction() };

var header = document.getElementById("myHeader");

var sticky = header.offsetTop;

function myFunction() {
  if (window.pageYOffset > sticky) {
    header.classList.add("sticky");
  } else {
    header.classList.remove("sticky");
  }
}
// sticky-header

// Initialize Lenis
const lenis = new Lenis({
  autoRaf: true,
});

// Listen for the scroll event and log the event data
lenis.on('scroll', (e) => {
  console.log(e);
});
