$(document).ready(function(){
    $("#testimonial-slider").owlCarousel({
        items: 2,
        pagination: false,
        navigation: true,
        navigationText: ["",""],
        autoPlay: true,
        responsive:{
            0:{
                items:1  // This will set 1 item to show on mobile devices
            },
            768:{
                items:2  // This will set 2 items to show on tablets and larger screens
            }
        }
    });
});
// Initialize Swiper
var swiper = new Swiper("#js-swiper-hotels", {
    slidesPerView: "auto",
    spaceBetween: 20,
    centeredSlides: true,
    pagination: {
      el: ".swiper-pagination",
      clickable: true,
    },
    breakpoints: {
        // For mobile devices
        768: {
          slidesPerView: 1,
          spaceBetween: 10,
        },
          1024: {
            slidesPerView: 2,
            spaceBetween: 20,
            centeredSlides: true,
          },
        },
    }
  );
  


  //Animations
const elements = document.querySelectorAll('.fadeinleft');
const elements1 = document.querySelectorAll('.fade-in');
const elements2 = document.querySelectorAll('.fadeinright');
const elements3 = document.querySelectorAll('.fadeindown');
const elements4 = document.querySelectorAll('.fadeinup');
const options = {
    root:null,
    rootMargin: '0px',
    threshold: .4
}
const callbacks = (entries) => {
    entries.forEach(entry => {
        if(entry.isIntersecting){
            entry.target.classList.add('active-left');
        }
    });
}
const callbacks1 = (entries) => {
    entries.forEach(entry => {
        if(entry.isIntersecting){
            entry.target.classList.add('active');
        }
    });
}
const callbacks2 = (entries) => {
    entries.forEach(entry => {
        if(entry.isIntersecting){
            entry.target.classList.add('active-right');
        }
    });
}
const callbacks3 = (entries) => {
    entries.forEach(entry => {
        if(entry.isIntersecting){
            entry.target.classList.add('active-down');
        }
    });
}
const callbacks4 = (entries) => {
  entries.forEach(entry => {
      if(entry.isIntersecting){
          entry.target.classList.add('active-up');
      }
  });
}
let observer = new IntersectionObserver(callbacks, options);
let observer1 = new IntersectionObserver(callbacks1, options);
let observer2 = new IntersectionObserver(callbacks2, options);
let observer3 = new IntersectionObserver(callbacks3, options);
let observer4 = new IntersectionObserver(callbacks4, options);
elements.forEach(elements =>{
    observer.observe(elements);
})
elements1.forEach(elements1 =>{
    observer1.observe(elements1);
})
elements2.forEach(elements2 =>{
    observer2.observe(elements2);
})
elements3.forEach(elements3 =>{
    observer3.observe(elements3);
})
elements4.forEach(elements4 =>{
  observer4.observe(elements4);
})



$(document).ready(function() {
    $("#myCarousel").on("slide.bs.carousel", function(e) {
      var $e = $(e.relatedTarget);
      var idx = $e.index();
      var itemsPerSlide = 3;
      var totalItems = $(".carousel-item").length;
  
      if (idx >= totalItems - (itemsPerSlide - 1)) {
        var it = itemsPerSlide - (totalItems - idx);
        for (var i = 0; i < it; i++) {
          // append slides to end
          if (e.direction == "left") {
            $(".carousel-item")
              .eq(i)
              .appendTo(".carousel-inner");
          } else {
            $(".carousel-item")
              .eq(0)
              .appendTo($(this).find(".carousel-inner"));
          }
        }
      }
    });
  });

  var swiper = new Swiper(".gallery-slider", {
    spaceBetween: 10,
    grabCursor:true,
    loop:true,
    centeredSlides:true,
    autoplay: {
        delay: 1500,
        disableOnInteraction: false,
    },
    pagination: {
        el: ".swiper-pagination",
        clickable: true,
    },
    breakpoints: {
        0: {
            slidesPerView: 1,
        },
        768: {
            slidesPerView: 3,
        },
        991: {
            slidesPerView: 4,
        },
    },
});  
var angle = 0;
function galleryspin(sign) { 
spinner = document.querySelector("#spinner");
if (!sign) { angle = angle + 45; } else { angle = angle - 45; }
spinner.setAttribute("style","-webkit-transform: rotateY("+ angle +"deg); -moz-transform: rotateY("+ angle +"deg); transform: rotateY("+ angle +"deg);");
}