(function ($) {

  $(".open-menu").click(function() {
    $(".navbar-collapse").addClass("in");
  });
  
      $(".close-menu").click(function() {
    $(".navbar-collapse").removeClass("in");
  });
  
  $(".open-menu").keypress(function(e) {
  var key = e.which;
  if (key == 13) // the enter key code
  {
    $(".navbar-collapse").addClass("in");
   }
  });
  
      $(".close-menu").keypress(function(e) {
  var key = e.which;
  if (key == 13) // the enter key code
  {
    $(".navbar-collapse").removeClass("in");
  }
  });
  
  $('.card-slider-wrap').slick({
    infinite: true,
    autoplay: true,
    arrows: false,
    dots: true,
    slidesToShow: 3,
    pauseOnHover: false,
    centerMode: false,
    responsive: [
      {
        breakpoint: 990,
        settings: {
          slidesToShow: 2,
          autoplay: true,
          slidesToScroll: 1,
        }
      },
      {
        breakpoint: 768,
        settings: {
          slidesToShow: 2,
          autoplay: true,
          slidesToScroll: 1,
        }
      },
      {
        breakpoint: 600,
        settings: {
          slidesToShow: 1,
          autoplay: true,
          slidesToScroll: 1,
        }
      }
    ]
  });


  $(".wprm-recipe-template-snippet-basic-buttons").insertAfter(".single .entry-header");

})(jQuery);


if (jQuery(window).width() < 991){
  const  elegant_recipe_blog_focusableElements =
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
const elegant_recipe_blog_modal = document.querySelector('div#navbar-collapse1'); 

const elegant_recipe_blog_firstFocusableElement = elegant_recipe_blog_modal.querySelectorAll(elegant_recipe_blog_focusableElements)[0]; 
const elegant_recipe_blog_focusableContent = elegant_recipe_blog_modal.querySelectorAll(elegant_recipe_blog_focusableElements);
const elegant_recipe_blog_lastFocusableElement = elegant_recipe_blog_focusableContent[elegant_recipe_blog_focusableContent.length - 1];


document.addEventListener('keydown', function(e) {
let isTabPressed = e.key === 'Tab' || e.keyCode === 9;

if (!isTabPressed) {
  return;
}

if (e.shiftKey) { // if shift key pressed for shift + tab combination
  if (document.activeElement === elegant_recipe_blog_firstFocusableElement) {
    elegant_recipe_blog_lastFocusableElement.focus(); // add focus for the last focusable element
    e.preventDefault();
  }
} else { // if tab key is pressed
  if (document.activeElement === elegant_recipe_blog_lastFocusableElement) { // if focused has reached to last focusable element then focus first focusable element after pressing tab
    elegant_recipe_blog_firstFocusableElement.focus(); // add focus for the first focusable element
    e.preventDefault();
  }
}
});

elegant_recipe_blog_firstFocusableElement.focus();
  }