Changeset 9427
- Timestamp:
- 01/28/2020 12:09:14 AM (5 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-breathe
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-breathe/js/chapters.js
r5875 r9427 1 1 // Mobile Subnav open/close 2 jQuery(document).ready(function() { 2 jQuery( document ).ready( function () { 3 4 var tocContainer = jQuery( 'div[class*="-table-of-contents-container"]' ).first(); 5 6 if ( 0 === tocContainer.length ) { 7 return; 8 } 3 9 4 10 // Add our expandable button 5 jQuery( '.menu-table-of-contents-container > ul >.menu-item-has-children > a' )11 tocContainer.find( '> ul .menu-item-has-children > a' ) 6 12 .wrap( '<div class="expandable"></div>' ) 7 13 .after( '<button class="dashicons dashicons-arrow-down-alt2" aria-expanded="false"></button>' ); 8 14 9 // Invisibly openall of the submenus10 jQuery( '.menu-item-has-children > ul ul' ). addClass( 'default-open');15 // Invisibly hide all of the submenus 16 jQuery( '.menu-item-has-children > ul ul' ).hide(); 11 17 12 18 // Open the current menu 13 jQuery( '.menu-table-of-contents-container.current-menu-item a' ).first()19 tocContainer.find( '.current-menu-item a' ).first() 14 20 .addClass( 'active' ) 15 21 .parents( '.menu-item-has-children' ) 16 22 .toggleClass( 'open' ) 17 23 .find( '> div > .dashicons' ) 18 24 .attr( 'aria-expanded', true ); 19 25 26 // Open the current submenu 27 $secondary_menu = tocContainer.find( '.current-menu-item > ul' ); 28 if ( $secondary_menu.length ) { 29 $secondary_menu.show(); 30 } else { 31 tocContainer.find( '.current-menu-item' ).parents( 'ul' ).show(); 32 } 20 33 // Or if wrapped in a div.expandable 21 jQuery( '.menu-item-has-children > div > .dashicons' ).click( function () {34 jQuery( '.menu-item-has-children > div > .dashicons' ).click( function () { 22 35 var menuToggle = jQuery( this ).closest( '.menu-item-has-children' ); 23 36 24 jQuery( this ).parent().siblings( '.children' ).slideToggle(); 37 jQuery( this ).parent().siblings( '.sub-menu' ).length 38 ? jQuery( this ).parent().siblings( '.sub-menu' ).slideToggle() 39 : jQuery( this ).parent().siblings( '.children' ).slideToggle() 25 40 26 41 menuToggle.toggleClass( 'open' ); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-breathe/style.css
r9425 r9427 1336 1336 } 1337 1337 .menu-table-of-contents-container .current_page_ancestor:not(.open) .expandable .dashicons:not(:focus), 1338 .menu-table-of-contents-container .current_page_item .expandable .dashicons:not(:focus) {1338 .menu-table-of-contents-container .current_page_item > .expandable .dashicons:not(:focus) { 1339 1339 background: #fff; 1340 1340 color: #0073aa;
Note: See TracChangeset
for help on using the changeset viewer.