jQuery(document).ready(function ($) {
	var shoes_footwear_owl = jQuery('.test .owl-carousel');
		shoes_footwear_owl.owlCarousel({
			margin:20,
			nav: true,
			autoplay : true,
			lazyLoad: true,
			autoplayTimeout: 3000,
			loop: true,
			dots:false,
			navText : ['<i class="fas fa-arrow-left-long"></i>','<i class="fas fa-arrow-right-long"></i> '],
			responsive: {
			0: {
				items: 1,
				dots: true,
			},
			600: {
				items: 1,
				dots: true,
			},
			1000: {
				items: 1, 
				dots: true,
			},
		},
		autoplayHoverPause : true,
		mouseDrag: true
	});

  if ( typeof $.fn.owlCarousel !== 'function' ) {
      console.warn('Owl Carousel not found.');
      return;
  }

	$('.mobile-nav .toggle-button').on( 'click', function() {
		$('.mobile-nav .main-navigation').slideToggle();
	});

	$('.mobile-nav-wrap .close ').on( 'click', function() {
		$('.mobile-nav .main-navigation').slideToggle();

	});

	$('<button class="submenu-toggle"></button>').insertAfter($('.mobile-nav ul .menu-item-has-children > a, .mobile-nav ul .page_item_has_children > a'));
	$('.mobile-nav ul li .submenu-toggle').on( 'click', function() {
		$(this).next().slideToggle();
		$(this).toggleClass('open');
	});

	// dropdown category
	jQuery(document).ready(function(){
		
		jQuery(".category-dropdown").hide();

		jQuery("button.category-btn").click(function(e){
			e.stopPropagation();
			jQuery(".category-dropdown").toggle();
		});

		jQuery(".category-dropdown").click(function(e){
			e.stopPropagation();
		});

		jQuery(document).click(function(){
			jQuery(".category-dropdown").hide();
		});

		jQuery(".category-btn, .category-dropdown").on("keydown", function(e) {
			var shoes_footwear_dropdownItems = jQuery(".category-dropdown").find("a");

			if (e.keyCode === 9) { 
				if (!e.shiftKey && document.activeElement === shoes_footwear_dropdownItems.last().get(0)) {
					e.preventDefault();
					jQuery(".category-btn").focus();
				} else if (e.shiftKey && document.activeElement === shoes_footwear_dropdownItems.first().get(0)) {
					e.preventDefault();
					jQuery(".category-btn").focus();
				}
			}
		});

	});

	//accessible menu for edge
	 $("#site-navigation ul li a").on( 'focus', function() {
	   $(this).parents("li").addClass("focus");
	}).on( 'blur', function() {
	    $(this).parents("li").removeClass("focus");
	 });
});

var shoes_footwear_btn = jQuery('#button');

jQuery(window).scroll(function() {
  if (jQuery(window).scrollTop() > 300) {
    shoes_footwear_btn.addClass('show');
  } else {
    shoes_footwear_btn.removeClass('show');
  }
});
shoes_footwear_btn.on('click', function(e) {
  e.preventDefault();
  jQuery('html, body').animate({scrollTop:0}, '300');
});

window.addEventListener('load', (event) => {
    jQuery(".preloader").delay(1000).fadeOut("slow");
});

jQuery(window).scroll(function() {
    var shoes_footwear_data_sticky = jQuery('.head_bg').attr('data-sticky');

    if (shoes_footwear_data_sticky == 1) {
      if (jQuery(this).scrollTop() > 1){  
        jQuery('.head_bg').addClass("sticky-head");
      } else {
        jQuery('.head_bg').removeClass("sticky-head");
      }
    }
});

function shoes_footwear_preloderFunction() {
    setTimeout(function() {           
        document.getElementById("page-top").scrollIntoView();
        
        $('#ctn-preloader').addClass('loaded');  
        // Once the preloader has finished, the scroll appears 
        $('body').removeClass('no-scroll-y');

        if ($('#ctn-preloader').hasClass('loaded')) {
            // It is so that once the preloader is gone, the entire preloader section will removed
            $('#preloader').delay(1000).queue(function() {
                $(this).remove();
                
                // If you want to do something after removing preloader:
                shoes_footwear_afterLoad();
                
            });
        }
    }, 3000);
}
function shoes_footwear_afterLoad() {
    // After Load function body!
}