/**
  * Theme Js file.
**/
// preloader
jQuery('document').ready(function($){
  setTimeout(function () {
    jQuery(".loader").fadeOut("slow");
  },1000);
});

// scrollto top
jQuery(function($){
  $(window).scroll(function() {
    if ($(this).scrollTop() >= 50) {
      $('#return-to-top').fadeIn(200);
    } else {
      $('#return-to-top').fadeOut(200);
    }
  });
  $('#return-to-top').click(function() {
    $('body,html').animate({
      scrollTop : 0
    }, 500);
  });
});

// ===== Mobile responsive Menu ====
function amusement_park_menu_open_nav() {
  jQuery(".sidenav").addClass('open');
}
function amusement_park_menu_close_nav() {
  jQuery(".sidenav").removeClass('open');
}

// slider owl
jQuery(document).ready(function($) {
  $('#slider .owl-carousel').owlCarousel({
    loop: true,
    margin: 10,
    nav: true,
    items: 1,
  });
});

// about
jQuery(document).ready(function() {
    // Initialize the .abt-cat slider
    jQuery('.abt-cat .owl-carousel').owlCarousel({
        loop: true,
        margin: 0,
        nav: false,
        dots: false,
        rtl: false,
        items: 6,
        autoplay: true,
        autoplayTimeout: 3000,
        autoplayHoverPause: true,
    });

});

// contact form
document.addEventListener('DOMContentLoaded', function () {
    var counters = document.querySelectorAll('.counter');

    counters.forEach(function(counter) {
        var minusButton = counter.querySelector('.minus');
        var plusButton = counter.querySelector('.plus');
        var inputField = counter.querySelector('input');

        minusButton.addEventListener('click', function() {
            var currentValue = parseInt(inputField.value);
            if (currentValue > 1) { // Assuming min value is 1
                inputField.value = currentValue - 1;
            }
        });

        plusButton.addEventListener('click', function() {
            var currentValue = parseInt(inputField.value);
            if (currentValue < 100) { // Assuming max value is 100
                inputField.value = currentValue + 1;
            }
        });
    });
});


