document.addEventListener('DOMContentLoaded', function() {
    const gridRow = document.querySelector('.grid-row');
    if (gridRow) {
        gridRow.classList.add('owl-carousel');
    }
});

jQuery(document).ready(function ($) {
  $(window).scroll(function () {
    if ($(this).scrollTop() > 100) {
      $(".back-to-top a").fadeIn();
    } else {
      $(".back-to-top a").fadeOut();
    }
  });
  $(".back-to-top a").click(function () {
    $("html, body").animate({ scrollTop: 0 }, 800);
    return false;
  });

  // Category Slider
  $('.grid-row.owl-carousel').owlCarousel({
      margin: 30,
      nav: true,
      autoplay: true,
      lazyLoad: true,
      autoplayTimeout: 2000,
      loop: true,
      dots: false,
      responsive: {
        0: { items: 1 },
        768: { items: 2 },
        992: { items: 3 },
        1200: { items: 4 }
      },
      autoplayHoverPause: true,
      mouseDrag: true
  });

});