Created
November 15, 2020 23:27
-
-
Save wplit/04e1d80fdb0e2abe36a17395ae3f2159 to your computer and use it in GitHub Desktop.
allow hashlink inside one offcanvas make sure the second one is also closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery(document).ready(function($) { | |
| // Change these selectors to match the class or ID of your offcanvas elements | |
| let mainOffcanvas = '.main-offcanvas', | |
| secondOffcanvas = '.second-offcanvas'; | |
| // Make sure second offcanvas is closed | |
| $(mainOffcanvas).find('a[href*=\\#]').not(".menu-item-has-children > a").on('click', function(e) { | |
| e.stopPropagation(); | |
| if (this.pathname === window.location.pathname) { | |
| $(secondOffcanvas).removeClass('oxy-off-canvas-toggled'); | |
| } | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment