Ticket #24839: 24839.twenty-twelve.4.diff
File 24839.twenty-twelve.4.diff, 4.3 KB (added by , 11 years ago) |
---|
-
wp-content/themes/twentytwelve/css/ie.css
110 110 position: absolute; 111 111 top: 100%; 112 112 z-index: 1; 113 clip: rect(1px 1px 1px 1px); /* IE6, IE7 */ 113 114 } 114 115 .ie7 .main-navigation li ul { 115 116 left: 0; -
wp-content/themes/twentytwelve/functions.php
140 140 wp_enqueue_script( 'comment-reply' ); 141 141 142 142 // Adds JavaScript for handling the navigation menu hide-and-show behavior. 143 wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array( ), '1.0', true );143 wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ), '20140318', true ); 144 144 145 145 $font_url = twentytwelve_get_font_url(); 146 146 if ( ! empty( $font_url ) ) -
wp-content/themes/twentytwelve/js/navigation.js
1 1 /** 2 * navigation.js 3 * 4 * Handles toggling the navigation menu for small screens. 2 * Handles toggling the navigation menu for small screens and 3 * accessibility for submenu items. 5 4 */ 6 5 ( function() { 7 6 var nav = document.getElementById( 'site-navigation' ), button, menu; 8 if ( ! nav ) 7 if ( ! nav ) { 9 8 return; 9 } 10 10 11 button = nav.getElementsByTagName( 'h3' )[0]; 11 12 menu = nav.getElementsByTagName( 'ul' )[0]; 12 if ( ! button ) 13 if ( ! button ) { 13 14 return; 15 } 14 16 15 17 // Hide button if menu is missing or empty. 16 18 if ( ! menu || ! menu.childNodes.length ) { … … 19 21 } 20 22 21 23 button.onclick = function() { 22 if ( -1 == menu.className.indexOf( 'nav-menu' ) )24 if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { 23 25 menu.className = 'nav-menu'; 26 } 24 27 25 if ( -1 != button.className.indexOf( 'toggled-on' ) ) {28 if ( -1 !== button.className.indexOf( 'toggled-on' ) ) { 26 29 button.className = button.className.replace( ' toggled-on', '' ); 27 30 menu.className = menu.className.replace( ' toggled-on', '' ); 28 31 } else { … … 30 33 menu.className += ' toggled-on'; 31 34 } 32 35 }; 33 } )(); 34 No newline at end of file 36 } )(); 37 38 // Better focus for hidden submenu items for accessibility. 39 ( function( $ ) { 40 $( '.main-navigation' ).find( 'a' ).on( 'focus.twentytwelve blur.twentytwelve', function() { 41 $( this ).parents( '.menu-item, .page_item' ).toggleClass( 'focus' ); 42 } ); 43 } )( jQuery ); -
wp-content/themes/twentytwelve/style.css
590 590 .main-navigation a { 591 591 color: #5e5e5e; 592 592 } 593 .main-navigation a:hover { 593 .main-navigation a:hover, 594 .main-navigation a:focus { 594 595 color: #21759b; 595 596 } 596 597 .main-navigation ul.nav-menu, … … 1509 1510 text-transform: uppercase; 1510 1511 white-space: nowrap; 1511 1512 } 1512 .main-navigation li a:hover { 1513 .main-navigation li a:hover, 1514 .main-navigation li a:focus { 1513 1515 color: #000; 1514 1516 } 1515 1517 .main-navigation li { … … 1518 1520 position: relative; 1519 1521 } 1520 1522 .main-navigation li ul { 1521 display: none;1522 1523 margin: 0; 1523 1524 padding: 0; 1524 1525 position: absolute; 1525 1526 top: 100%; 1526 1527 z-index: 1; 1528 height: 1px; 1529 width: 1px; 1530 overflow: hidden; 1531 clip: rect(1px, 1px, 1px, 1px) 1527 1532 } 1528 1533 .main-navigation li ul ul { 1529 1534 top: 0; 1530 1535 left: 100%; 1531 1536 } 1532 .main-navigation ul li:hover > ul { 1537 .main-navigation ul li:hover > ul, 1538 .main-navigation ul li:focus > ul, 1539 .main-navigation .focus > ul { 1533 1540 border-left: 0; 1534 display: block; 1541 clip: inherit; 1542 overflow: inherit; 1543 height: inherit; 1544 width: inherit; 1535 1545 } 1536 1546 .main-navigation li ul li a { 1537 1547 background: #efefef; … … 1546 1556 width: 12.85714286rem; 1547 1557 white-space: normal; 1548 1558 } 1549 .main-navigation li ul li a:hover { 1559 .main-navigation li ul li a:hover, 1560 .main-navigation li ul li a:focus { 1550 1561 background: #e3e3e3; 1551 1562 color: #444; 1552 1563 }