// Scroll to Top
window.onscroll = function() {
  const online_education_academy_button = document.querySelector('.scroll-top-box');
  if (online_education_academy_button) {
    if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
      online_education_academy_button.style.display = "block";
    } else {
      online_education_academy_button.style.display = "none";
    }
  }
};

const scrollTopLink = document.querySelector('.scroll-top-box a');
if (scrollTopLink) {
  scrollTopLink.onclick = function(event) {
    event.preventDefault();
    window.scrollTo({ top: 0, behavior: 'smooth' });
  };
}

// ===== courses ====
jQuery(document).ready(function($){
  var owl = $('.courses-sec .owl-carousel');
  owl.owlCarousel({
    margin: 20,
    nav: false,
    autoplay: false,
    lazyLoad: true,
    autoplayTimeout: 3000,
    loop: true,
    dots: false,
    responsive: {
      0: {
        items: 1
      },
      600: {
        items: 2
      },
      1024: {
        items: 3
      },
      1200: {
        items: 3
      }
    },
    autoplayHoverPause: true,
    mouseDrag: true
  });
});

// ===== courses ====
jQuery(document).ready(function($){
  var owl = $('.counter-sec .owl-carousel');
  owl.owlCarousel({
    margin: 20,
    nav: false,
    autoplay: false,
    lazyLoad: true,
    autoplayTimeout: 3000,
    loop: true,
    dots: false,
    responsive: {
      0: {
        items: 1
      },
      600: {
        items: 3
      },
      1024: {
        items: 3
      },
      1200: {
        items: 5
      }
    },
    autoplayHoverPause: true,
    mouseDrag: true
  });
});

// latest blog
jQuery(document).ready(function() {
  jQuery('.blog-section .owl-carousel').owlCarousel({
    loop: true,
    margin: 30,
    nav: false,
    dots: false,
    rtl: false,
    responsive: {
    0: { 
      items: 1 
    },
    600: { 
      items: 2 
    },
    1024: { 
      items: 3
    },
    1200: { 
      items: 3
    }
  },
    autoplay: false,
  });
});