WordPress.org

Make WordPress Core

Ticket #21697: twentytwelve_navigation_nojs.patch

File twentytwelve_navigation_nojs.patch, 1.3 KB (added by Jayjdk, 6 years ago)

Adds no-js to the body tag

  • functions.php

     
    382382                $classes[] = 'custom-background-empty';
    383383        elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) )
    384384                $classes[] = 'custom-background-white';
     385               
     386        $classes[] = 'no-js';
    385387
    386388        return $classes;
    387389}
  • js/navigation.js

     
    44 * Handles toggling the navigation menu for small screens.
    55 */
    66( function() {
     7        // Remove no-js class from body
     8        document.body.className = document.body.className.replace('no-js','js');
     9
    710        var button = document.getElementById( 'site-navigation' ).getElementsByTagName( 'h3' )[0],
    811            menu   = document.getElementById( 'site-navigation' ).getElementsByTagName( 'ul' )[0];
    912
  • style.css

     
    537537        display: inline-block;
    538538}
    539539
     540/* Show navigation when javascript is off */
     541.no-js .main-navigation ul.nav-menu {
     542   display: block;
     543}
     544.no-js .menu-toggle {
     545  display: none;
     546}
     547
    540548/* Banner */
    541549section[role="banner"] {
    542550        margin-bottom: 48px;