function pet_accessory_store_openNav() {
  jQuery(".sidenav").addClass('show');
}
function pet_accessory_store_closeNav() {
  jQuery(".sidenav").removeClass('show');
}

( function( window, document ) {
  function pet_accessory_store_keepFocusInMenu() {
    document.addEventListener( 'keydown', function( e ) {
      const pet_accessory_store_nav = document.querySelector( '.sidenav' );

      if ( ! pet_accessory_store_nav || ! pet_accessory_store_nav.classList.contains( 'show' ) ) {
        return;
      }
      const elements = [...pet_accessory_store_nav.querySelectorAll( 'input, a, button' )],
        pet_accessory_store_lastEl = elements[ elements.length - 1 ],
        pet_accessory_store_firstEl = elements[0],
        pet_accessory_store_activeEl = document.activeElement,
        tabKey = e.keyCode === 9,
        shiftKey = e.shiftKey;

      if ( ! shiftKey && tabKey && pet_accessory_store_lastEl === pet_accessory_store_activeEl ) {
        e.preventDefault();
        pet_accessory_store_firstEl.focus();
      }

      if ( shiftKey && tabKey && pet_accessory_store_firstEl === pet_accessory_store_activeEl ) {
        e.preventDefault();
        pet_accessory_store_lastEl.focus();
      }
    } );
  }
  pet_accessory_store_keepFocusInMenu();
} )( window, document );

var pet_accessory_store_btn = jQuery('#button');

jQuery(window).scroll(function() {
  if (jQuery(window).scrollTop() > 300) {
    pet_accessory_store_btn.addClass('show');
  } else {
    pet_accessory_store_btn.removeClass('show');
  }
});

pet_accessory_store_btn.on('click', function(e) {
  e.preventDefault();
  jQuery('html, body').animate({scrollTop:0}, '300');
});

window.addEventListener('load', (event) => {
  jQuery(".loading").delay(2000).fadeOut("slow");
  jQuery(".loading2").delay(2000).fadeOut("slow");
});

jQuery(window).scroll(function() {
  var data_sticky = jQuery('.main-header').attr('data-sticky');

  if (data_sticky == "true") {
    if (jQuery(this).scrollTop() > 1){
      jQuery('.main-header').addClass("stick_header");
    } else {
      jQuery('.main-header').removeClass("stick_header");
    }
  }
});