| | 1 | if( 'undefined' != typeof( jQuery ) ){ |
| | 2 | |
| | 3 | jQuery(document).ready(function($){ |
| | 4 | |
| | 5 | var wpAdminBarChildren = $('#wpadminbar li.menupop'); |
| | 6 | if( wpAdminBarChildren.length ){ |
| | 7 | |
| | 8 | var wpAdminBarMobileHide = function(e){ |
| | 9 | if( ! $(e.target).closest('#wpadminbar').length ){ |
| | 10 | wpAdminBarChildren.removeClass('hover'); |
| | 11 | $(document.body).unbind( 'click', wpAdminBarMobileHide ); |
| | 12 | } |
| | 13 | } |
| | 14 | |
| | 15 | wpAdminBarChildren.click(function(e){ |
| | 16 | if( ! $(this).hasClass('hover') ){ |
| | 17 | e.preventDefault(); |
| | 18 | wpAdminBarChildren.removeClass('hover'); |
| | 19 | $(this).addClass('hover'); |
| | 20 | $(document.body).bind( 'click', wpAdminBarMobileHide ); |
| | 21 | return; |
| | 22 | } |
| | 23 | }); |
| | 24 | |
| | 25 | } |
| | 26 | |
| | 27 | var wpAdminMenuChildren = $('#adminmenu > li.wp-has-submenu.wp-not-current-submenu'); |
| | 28 | if( wpAdminMenuChildren.length ){ |
| | 29 | |
| | 30 | var wpAdminMenuMobileHide = function(e){ |
| | 31 | if( ! $(e.target).closest('#adminmenu').length ){ |
| | 32 | wpAdminMenuChildren.removeClass('hover').children('.wp-submenu.sub-open').removeClass('sub-open'); |
| | 33 | $(document.body).unbind( 'click', wpAdminMenuMobileHide ); |
| | 34 | } |
| | 35 | } |
| | 36 | |
| | 37 | wpAdminMenuChildren.click(function(e){ |
| | 38 | if( ! $(this).hasClass('hover') ){ |
| | 39 | e.preventDefault(); |
| | 40 | wpAdminMenuChildren.removeClass('hover').children('.wp-submenu.sub-open').removeClass('sub-open'); |
| | 41 | $(this).addClass('hover').children('.wp-submenu').addClass('sub-open'); |
| | 42 | $(document.body).bind( 'click', wpAdminMenuMobileHide ); |
| | 43 | return; |
| | 44 | } |
| | 45 | }); |
| | 46 | |
| | 47 | } |
| | 48 | }); |
| | 49 | |
| | 50 | }else{ |
| | 51 | |
| | 52 | // fallback? |
| | 53 | |
| | 54 | } |
| | 55 | No newline at end of file |