jQuery(function($) {
    "use strict";

    // Scroll to top functionality
    $(window).on('scroll', function() {
        if ($(this).scrollTop() >= 50) {
            $('#return-to-top').fadeIn(200);
        } else {
            $('#return-to-top').fadeOut(200);
        }
    });

    $('#return-to-top').on('click', function() {
        $('body,html').animate({ scrollTop: 0 }, 500);
    });

    // Side navigation toggle
    $('.gb_toggle').on('click', function() {
        crowdfunding_nonprofit_Keyboard_loop($('.side_gb_nav'));
    });

    // Preloader fade out
    setTimeout(function() {
        $(".loader").fadeOut("slow");
    }, 1000);

});

// Mobile responsive menu
function crowdfunding_nonprofit_menu_open_nav() {
    jQuery(".sidenav").addClass('open');
}

function crowdfunding_nonprofit_menu_close_nav() {
    jQuery(".sidenav").removeClass('open');
}

// About
jQuery(document).ready(function($) {
  // Initialize the .abt-cat slider
  $('.abt-cat .owl-carousel').owlCarousel({
    loop: true,
    margin: 0,
    nav: false,
    dots: false,
    rtl: false,
    responsive: {
      0: {    
        items: 1
      },
      768: {  
        items: 2 
      },
      1024: {  
        items: 3
      },
      1025: {  
        items: 4
      }
    },
    autoplay: false,
    autoplayTimeout: 3000,
    autoplayHoverPause: true
  });
});

// About
jQuery(document).ready(function($) {
  // Initialize the .abt-cat slider with responsive items
  $('#our-services .owl-carousel').owlCarousel({
    loop: true,
    margin: 20,
    nav: false,
    dots: false,
    rtl: false,
    autoplay: false,
    autoplayTimeout: 3000,
    autoplayHoverPause: true,
    responsive: {
      0: {    
        items: 1
      },
      768: {  
        items: 2 
      },
      1024: {  
        items: 3
      },
      1025: {  
        items: 4
      }
    }
  });
});