Skip to content

Instantly share code, notes, and snippets.

@wplit
Created June 6, 2020 12:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wplit/b368f7d12392aa0b52ca9f5df9c02069 to your computer and use it in GitHub Desktop.
Save wplit/b368f7d12392aa0b52ca9f5df9c02069 to your computer and use it in GitHub Desktop.
make sure offcanvas closes when menu item clicked if hashlink
jQuery('.oxy-off-canvas .menu-item a[href*=\\#]').on('click', function (event) {
if(this.pathname === window.location.pathname){
jQuery('body').removeClass('off-canvas-toggled');
jQuery('.oxy-off-canvas').removeClass('oxy-off-canvas-toggled');
jQuery(jQuery('.offcanvas-inner').data('trigger-selector')).find('.hamburger').removeClass('is-active');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment