Created
December 14, 2017 14:21
-
-
Save Pavracer/0c2e076fdf34929cda4f861f3f555e28 to your computer and use it in GitHub Desktop.
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
| <script type="text/javascript"> | |
| (function($) { | |
| function setup_collapsible_submenus() { | |
| var $menu = $('#mobile_menu'), | |
| top_level_link = '#mobile_menu .menu-item-has-children > a'; | |
| $menu.find('a').each(function() { | |
| $(this).off('click'); | |
| if ( $(this).is(top_level_link) ) { | |
| $(this).attr('href', '#'); | |
| } | |
| if ( ! $(this).siblings('.sub-menu').length ) { | |
| $(this).on('click', function(event) { | |
| $(this).parents('.mobile_nav').trigger('click'); | |
| }); | |
| } else { | |
| $(this).on('click', function(event) { | |
| event.preventDefault(); | |
| $(this).parent().toggleClass('visible'); | |
| }); | |
| } | |
| }); | |
| } | |
| $(window).load(function() { | |
| setTimeout(function() { | |
| setup_collapsible_submenus(); | |
| }, 700); | |
| }); | |
| })(jQuery); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment