二十七菜单无响应,不可点击

时间:2017-12-09 作者:user2406

我正在定制2017主题。响应菜单中存在问题,无法单击菜单。这是我的标题代码。php

<?php
/**
* The header for our theme
*
* This is the template that displays all of the <head> section and everything up until <div id="content">
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package WordPress
* @subpackage Twenty_Seventeen
* @since 1.0
* @version 1.0
*/

?><!DOCTYPE html>

<html <?php language_attributes(); ?> class="no-js no-svg">
<head>
<meta charset="<?php bloginfo( \'charset\' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">

<?php wp_head(); ?>
<link rel="profile" href="http://gmpg.org/xfn/11">
<script src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/jquery.min.js"></script>    
<link href="<?php echo esc_url( get_template_directory_uri() ); ?>//assets/css/jquery-ui.css" rel="stylesheet">
<script src="<?php echo esc_url( get_template_directory_uri() ); ?>//assets/js/jquery-1.10.2.js"></script>
<script src="<?php echo esc_url( get_template_directory_uri() ); ?>//assets/js/jquery-ui.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>//assets/js/jquery-ui.min.js">
</script>
 <script>
         $(function() {
            $( "#accordion-1" ).accordion();
         });
      </script>
          <script type="text/javascript">
                    jQuery(document).ready(function($) {
                        $(\'.nav-menu li.menu-item a\').addClass(\'hvr-underline-from-left\');
                        $(\'.nav-menu\').addClass(\'group\');
                        $(\'.nav-menu\').attr(\'id\', \'example-one\');
                        $(\'.nav-menu\').parent(\'div\').addClass(\'nav-wrap\');
                    });
                </script>
 <style>
   #accordion-1{font-size: 14px;} </style>
<script src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/wp-emoji-release.min.js" type="text/javascript"></script>
    <style type="text/css">
    img.wp-smiley,
    img.emoji {
    display: inline !important;
    border: none !important;
    box-shadow: none !important;
    height: 1em !important;
    width: 1em !important;
    margin: 0 .07em !important;
    vertical-align: -0.1em !important;
    background: none !important;
    padding: 0 !important;
    }
</style>
<link href="//cdn.rawgit.com/noelboss/featherlight/1.3.2/release/featherlight.min.css" type="text/css" rel="stylesheet" title="Featherlight Styles" />
<script src="//cdn.rawgit.com/noelboss/featherlight/1.3.2/release/featherlight.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" id="contact-form-7-css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/styles.css" type="text/css" media="all">
<link rel="stylesheet" id="twentyseventeen-fonts-css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/css" type="text/css" media="all">
<link rel="stylesheet" id="genericons-css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/genericons.css" type="text/css" media="all">
<link rel="stylesheet" id="twentyseventeen-style-css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/style.css" type="text/css" media="all">
<link rel="stylesheet" id="bootstrap-css-css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/bootstrap.css" type="text/css" media="all">
<link rel="stylesheet" id="camera-css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/camera.css" type="text/css" media="all">
<link rel="stylesheet" id="custom-css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/custom.css" type="text/css" media="all">
<link rel="stylesheet" id="responsive-css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/responsive.css" type="text/css" media="all">
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/jquery.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/jquery-migrate.min.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/jquery.backstretch.min.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/theme.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/custom.js"></script>
<link rel="stylesheet" id="accordion" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/accodian.css" type="text/css" media="all">
<meta name="generator" content="WordPress 4.2.17">

<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>

                        <script>
    jQuery(document).ready(function ($) {
        /*jQuery(\'#camera_wrap_4\').camera({
         height: \'auto\',
         loader: \'bar\',
         fx:\'simpleFade\',
         pagination: false,
         thumbnails: true,
         hover: false,
         opacityOnGrid: false,
         imagePath: \'../images/\'
         });

         jQuery(\'.link-img\').on(\'click\', function() {
         var pic_src = jQuery(this).data(\'src\');
         jQuery(\'#slide1\').attr("data-src", pic_src);
         })*/

       /* $.backstretch([
            "http://localhost/mimshach/wp-content/uploads/2017/11/1st_Picture.jpg"
                    , "http://localhost/mimshach/wp-content/uploads/2017/11/2nd-Picture.jpg"
                    , "http://localhost/mimshach/wp-content/uploads/2017/11/3rd-Picture.jpg"
        ], {duration: 30000, fade: 750});*/

        // Get the number of banner images on the page
        var numberImages = $(\'#nv-featurecarousel img.nv-imgbnr-bg\').length;
        var time = 30;
        var method = \'fadeAndRotate\';
        // if there is only one image loaded in the carousel the rotation
        // and sliding functions are not required

        /* if (numberImages > 1) {
         nvs.featurecarousel.start(numberImages, time, method);
         }
         $(\'#nv-carousel img\').css(\'height\', $(window).height());
         $(window).resize(function(){
         $(\'#nv-carousel img\').css(\'height\', $(window).height());
         });*/

    });
</script>

    <script>
    jQuery(document).ready(function($) {
    // Get the number of banner images on the page
    var numberImages = $(\'#nv-featurecarousel img.nv-imgbnr-bg\').length;
    var time = 30;
    var method = \'fadeAndRotate\';
    // if there is only one image loaded in the carousel the rotation
    // and sliding functions are not required
    if (numberImages > 1) {
    nvs.featurecarousel.start(numberImages, time, method);
    }
    $(\'#nv-carousel img\').css(\'height\', $(window).height());
    $(window).resize(function(){
    $(\'#nv-carousel img\').css(\'height\', $(window).height());
    });

    });
    </script>   
    <script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/jquery.form.min.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
var _wpcf7 = {"loaderUrl":"http:\\/\\/newtestserver.com\\/dev\\/mimshach\\/wp-content\\/plugins\\/contact-form-7\\/images\\/ajax-loader.gif","sending":"Sending ..."};
/* ]]> */
</script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/scripts.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/masonry.min.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/jquery.masonry.min.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/functions.js"></script> 
<!-- <script type="text/javascript" src="<?php //echo esc_url( get_template_directory_uri() ); ?>/assets/js/navigation.js"></script> -->
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/bootstrap.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/jquery.mobile.customized.min.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/jquery.easing.1.3.js"></script>
<!-- <script type="text/javascript" src="<?php //echo esc_url( get_template_directory_uri() ); ?>/assets/js/example.js"></script> -->

</head>

<body <?php body_class(); ?>>
    <div id="page" class="site">
    <a class="skip-link screen-reader-text" href="#content"><?php _e( \'Skip to content\', \'twentyseventeen\' ); ?></a>
    <header id="masthead" class="site-header" role="banner">
         <div class="container">
             <div class="row">
                <div class="top-header clearfix">
                    <div class="col-sm-3">
                            <div class="logo">
                                <?php get_template_part( \'template-parts/header/header\', \'image\' ); ?>
                            </div>
                    </div>

                 <div class="col-sm-9">
                    <div class="top-nav clearfix">
                        <?php wp_nav_menu( array(\'menu\'=> \'topbar\' ) ); ?>
                    </div>
                    <div class="top-search clearfix">
                        <?php if ( !function_exists(\'dynamic_sidebar\') || !dynamic_sidebar(\'sidebar-2\') ) : ?>
                         <?php endif; ?>
                    </div>
                </div>
                </div>
             </div>
         </div>

        <?php if ( has_nav_menu( \'top\' ) ) : ?>
        <div id="navbar" class="navbar">
            <nav id="site-navigation" class="navigation main-navigation" role="navigation">
            <div class="nav-wrap">
                <?php get_template_part( \'template-parts/navigation/navigation\', \'top\' ); ?>

            </div><!-- .wrap -->
             </nav>
        </div>
            <!-- .navigation-top -->
        <?php endif; ?>
    </header>
<?php
    /*
     * If a regular post or page, and not the front page, show the featured image.
     * Using get_queried_object_id() here since the $post global may not be set before a call to the_post().
     */
    if ( ( is_single() || ( is_page() && ! twentyseventeen_is_frontpage() ) ) && has_post_thumbnail( get_queried_object_id() ) ) :
        echo \'<div class="single-featured-image-header">\';
        echo get_the_post_thumbnail( get_queried_object_id(), \'twentyseventeen-featured-image\' );
        echo \'</div><!-- .single-featured-image-header -->\';
    endif;
    ?>
    <div class="site-content-contain">
       <div id="content" class="site-content">
这是我的职能。js公司

/***针对2017年的功能。**提供帮助函数以增强主题体验*/

( function( $ ) {
    var body    = $( \'body\' ),
        _window = $( window ),
        nav, button, menu;

    nav = $( \'#site-navigation\' );
    button = nav.find( \'.menu-toggle\' );
    menu = nav.find( \'.nav-menu\' );

    /**
     * Adds a top margin to the footer if the sidebar widget area is higher
     * than the rest of the page, to help the footer always visually clear
     * the sidebar.
     */
    $( function() {
        if ( body.is( \'.sidebar\' ) ) {
            var sidebar   = $( \'#secondary .widget-area\' ),
                secondary = ( 0 === sidebar.length ) ? -40 : sidebar.height(),
                margin    = $( \'#tertiary .widget-area\' ).height() - $( \'#content\' ).height() - secondary;

            if ( margin > 0 && _window.innerWidth() > 999 ) {
                $( \'#colophon\' ).css( \'margin-top\', margin + \'px\' );
            }
        }
    } );

    /**
     * Enables menu toggle for small screens.
     */
    ( function() {
        if ( ! nav || ! button ) {
            return;
        }

        // Hide button if menu is missing or empty.
        if ( ! menu || ! menu.children().length ) {
            button.hide();
            return;
        }

        button.on( \'click.twentyseventeen\', function() {
            nav.toggleClass( \'toggled-on\' );
            if ( nav.hasClass( \'toggled-on\' ) ) {
                $( this ).attr( \'aria-expanded\', \'true\' );
                menu.attr( \'aria-expanded\', \'true\' );
            } else {
                $( this ).attr( \'aria-expanded\', \'false\' );
                menu.attr( \'aria-expanded\', \'false\' );
            }
        } );

        // Fix sub-menus for touch devices.
        if ( \'ontouchstart\' in window ) {
            menu.find( \'.menu-item-has-children > a, .page_item_has_children > a\' ).on( \'touchstart.twentyseventeen\', function( e ) {
                var el = $( this ).parent( \'li\' );

                if ( ! el.hasClass( \'focus\' ) ) {
                    e.preventDefault();
                    el.toggleClass( \'focus\' );
                    el.siblings( \'.focus\' ).removeClass( \'focus\' );
                }
            } );
        }

        // Better focus for hidden submenu items for accessibility.
        menu.find( \'a\' ).on( \'focus.twentyseventeen blur.twentyseventeen\', function() {
            $( this ).parents( \'.menu-item, .page_item\' ).toggleClass( \'focus\' );
        } );
    } )();

    /**
     * @summary Add or remove ARIA attributes.
     * Uses jQuery\'s width() function to determine the size of the window and add
     * the default ARIA attributes for the menu toggle if it\'s visible.
     * @since Twenty Thirteen 1.5
     */
    function onResizeARIA() {
        if ( 643 > _window.width() ) {
            button.attr( \'aria-expanded\', \'false\' );
            menu.attr( \'aria-expanded\', \'false\' );
            button.attr( \'aria-controls\', \'primary-menu\' );
        } else {
            button.removeAttr( \'aria-expanded\' );
            menu.removeAttr( \'aria-expanded\' );
            button.removeAttr( \'aria-controls\' );
        }
    }

    _window
        .on( \'load.twentyseventeen\', onResizeARIA )
        .on( \'resize.twentyseventeen\', function() {
            onResizeARIA();
    } );

    /**
     * Makes "skip to content" link work correctly in IE9 and Chrome for better
     * accessibility.
     *
     * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
     */
    _window.on( \'hashchange.twentyseventeen\', function() {
        var element = document.getElementById( location.hash.substring( 1 ) );

        if ( element ) {
            if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {
                element.tabIndex = -1;
            }

            element.focus();
        }
    } );

    /**
     * Arranges footer widgets vertically.
     */
    if ( $.isFunction( $.fn.masonry ) ) {
        var columnWidth = body.is( \'.sidebar\' ) ? 228 : 245;

        $( \'#secondary .widget-area\' ).masonry( {
            itemSelector: \'.widget\',
            columnWidth: columnWidth,
            gutterWidth: 20,
            isRTL: body.is( \'.rtl\' )
        } );
    }
} )( jQuery );
我不明白为什么响应菜单没有打开。请帮帮我。

1 个回复
最合适的回答,由SO网友:signal2013 整理而成

代码中的这一行button.on( \'click.twentyseventeen\', function() { 应该是:

button.on( \'click\', function() {

这个.twentyseventeen 附加到一些事件名称之后。我不敢肯定这是必要的。你能核实一下吗?

结束

相关推荐

Use menus with anchors

我有一个CPT归档页面,我想创建一个导航菜单,该菜单将跳转到表单中的锚定<a name=\"post-slug\" http=\"{the permalink goes here}>The CPT Title</a>我已经能够在模板文件中创建锚定,所以这不是问题对于页面顶部的链接本身,我可以手动创建它们,也可以使用WordPress菜单系统中的自定义链接。。。。但是有很多,所以我宁愿尝试在WordPress菜单系统中创建一个常规菜单。问题是,我需要以某种方式调整它的输出,以更改常规

二十七菜单无响应,不可点击 - 小码农CODE - 行之有效找到问题解决它

二十七菜单无响应,不可点击

时间:2017-12-09 作者:user2406

我正在定制2017主题。响应菜单中存在问题,无法单击菜单。这是我的标题代码。php

<?php
/**
* The header for our theme
*
* This is the template that displays all of the <head> section and everything up until <div id="content">
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package WordPress
* @subpackage Twenty_Seventeen
* @since 1.0
* @version 1.0
*/

?><!DOCTYPE html>

<html <?php language_attributes(); ?> class="no-js no-svg">
<head>
<meta charset="<?php bloginfo( \'charset\' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">

<?php wp_head(); ?>
<link rel="profile" href="http://gmpg.org/xfn/11">
<script src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/jquery.min.js"></script>    
<link href="<?php echo esc_url( get_template_directory_uri() ); ?>//assets/css/jquery-ui.css" rel="stylesheet">
<script src="<?php echo esc_url( get_template_directory_uri() ); ?>//assets/js/jquery-1.10.2.js"></script>
<script src="<?php echo esc_url( get_template_directory_uri() ); ?>//assets/js/jquery-ui.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>//assets/js/jquery-ui.min.js">
</script>
 <script>
         $(function() {
            $( "#accordion-1" ).accordion();
         });
      </script>
          <script type="text/javascript">
                    jQuery(document).ready(function($) {
                        $(\'.nav-menu li.menu-item a\').addClass(\'hvr-underline-from-left\');
                        $(\'.nav-menu\').addClass(\'group\');
                        $(\'.nav-menu\').attr(\'id\', \'example-one\');
                        $(\'.nav-menu\').parent(\'div\').addClass(\'nav-wrap\');
                    });
                </script>
 <style>
   #accordion-1{font-size: 14px;} </style>
<script src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/wp-emoji-release.min.js" type="text/javascript"></script>
    <style type="text/css">
    img.wp-smiley,
    img.emoji {
    display: inline !important;
    border: none !important;
    box-shadow: none !important;
    height: 1em !important;
    width: 1em !important;
    margin: 0 .07em !important;
    vertical-align: -0.1em !important;
    background: none !important;
    padding: 0 !important;
    }
</style>
<link href="//cdn.rawgit.com/noelboss/featherlight/1.3.2/release/featherlight.min.css" type="text/css" rel="stylesheet" title="Featherlight Styles" />
<script src="//cdn.rawgit.com/noelboss/featherlight/1.3.2/release/featherlight.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" id="contact-form-7-css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/styles.css" type="text/css" media="all">
<link rel="stylesheet" id="twentyseventeen-fonts-css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/css" type="text/css" media="all">
<link rel="stylesheet" id="genericons-css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/genericons.css" type="text/css" media="all">
<link rel="stylesheet" id="twentyseventeen-style-css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/style.css" type="text/css" media="all">
<link rel="stylesheet" id="bootstrap-css-css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/bootstrap.css" type="text/css" media="all">
<link rel="stylesheet" id="camera-css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/camera.css" type="text/css" media="all">
<link rel="stylesheet" id="custom-css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/custom.css" type="text/css" media="all">
<link rel="stylesheet" id="responsive-css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/responsive.css" type="text/css" media="all">
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/jquery.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/jquery-migrate.min.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/jquery.backstretch.min.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/theme.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/custom.js"></script>
<link rel="stylesheet" id="accordion" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/accodian.css" type="text/css" media="all">
<meta name="generator" content="WordPress 4.2.17">

<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>

                        <script>
    jQuery(document).ready(function ($) {
        /*jQuery(\'#camera_wrap_4\').camera({
         height: \'auto\',
         loader: \'bar\',
         fx:\'simpleFade\',
         pagination: false,
         thumbnails: true,
         hover: false,
         opacityOnGrid: false,
         imagePath: \'../images/\'
         });

         jQuery(\'.link-img\').on(\'click\', function() {
         var pic_src = jQuery(this).data(\'src\');
         jQuery(\'#slide1\').attr("data-src", pic_src);
         })*/

       /* $.backstretch([
            "http://localhost/mimshach/wp-content/uploads/2017/11/1st_Picture.jpg"
                    , "http://localhost/mimshach/wp-content/uploads/2017/11/2nd-Picture.jpg"
                    , "http://localhost/mimshach/wp-content/uploads/2017/11/3rd-Picture.jpg"
        ], {duration: 30000, fade: 750});*/

        // Get the number of banner images on the page
        var numberImages = $(\'#nv-featurecarousel img.nv-imgbnr-bg\').length;
        var time = 30;
        var method = \'fadeAndRotate\';
        // if there is only one image loaded in the carousel the rotation
        // and sliding functions are not required

        /* if (numberImages > 1) {
         nvs.featurecarousel.start(numberImages, time, method);
         }
         $(\'#nv-carousel img\').css(\'height\', $(window).height());
         $(window).resize(function(){
         $(\'#nv-carousel img\').css(\'height\', $(window).height());
         });*/

    });
</script>

    <script>
    jQuery(document).ready(function($) {
    // Get the number of banner images on the page
    var numberImages = $(\'#nv-featurecarousel img.nv-imgbnr-bg\').length;
    var time = 30;
    var method = \'fadeAndRotate\';
    // if there is only one image loaded in the carousel the rotation
    // and sliding functions are not required
    if (numberImages > 1) {
    nvs.featurecarousel.start(numberImages, time, method);
    }
    $(\'#nv-carousel img\').css(\'height\', $(window).height());
    $(window).resize(function(){
    $(\'#nv-carousel img\').css(\'height\', $(window).height());
    });

    });
    </script>   
    <script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/jquery.form.min.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
var _wpcf7 = {"loaderUrl":"http:\\/\\/newtestserver.com\\/dev\\/mimshach\\/wp-content\\/plugins\\/contact-form-7\\/images\\/ajax-loader.gif","sending":"Sending ..."};
/* ]]> */
</script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/scripts.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/masonry.min.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/jquery.masonry.min.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/functions.js"></script> 
<!-- <script type="text/javascript" src="<?php //echo esc_url( get_template_directory_uri() ); ?>/assets/js/navigation.js"></script> -->
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/bootstrap.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/jquery.mobile.customized.min.js"></script>
<script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/jquery.easing.1.3.js"></script>
<!-- <script type="text/javascript" src="<?php //echo esc_url( get_template_directory_uri() ); ?>/assets/js/example.js"></script> -->

</head>

<body <?php body_class(); ?>>
    <div id="page" class="site">
    <a class="skip-link screen-reader-text" href="#content"><?php _e( \'Skip to content\', \'twentyseventeen\' ); ?></a>
    <header id="masthead" class="site-header" role="banner">
         <div class="container">
             <div class="row">
                <div class="top-header clearfix">
                    <div class="col-sm-3">
                            <div class="logo">
                                <?php get_template_part( \'template-parts/header/header\', \'image\' ); ?>
                            </div>
                    </div>

                 <div class="col-sm-9">
                    <div class="top-nav clearfix">
                        <?php wp_nav_menu( array(\'menu\'=> \'topbar\' ) ); ?>
                    </div>
                    <div class="top-search clearfix">
                        <?php if ( !function_exists(\'dynamic_sidebar\') || !dynamic_sidebar(\'sidebar-2\') ) : ?>
                         <?php endif; ?>
                    </div>
                </div>
                </div>
             </div>
         </div>

        <?php if ( has_nav_menu( \'top\' ) ) : ?>
        <div id="navbar" class="navbar">
            <nav id="site-navigation" class="navigation main-navigation" role="navigation">
            <div class="nav-wrap">
                <?php get_template_part( \'template-parts/navigation/navigation\', \'top\' ); ?>

            </div><!-- .wrap -->
             </nav>
        </div>
            <!-- .navigation-top -->
        <?php endif; ?>
    </header>
<?php
    /*
     * If a regular post or page, and not the front page, show the featured image.
     * Using get_queried_object_id() here since the $post global may not be set before a call to the_post().
     */
    if ( ( is_single() || ( is_page() && ! twentyseventeen_is_frontpage() ) ) && has_post_thumbnail( get_queried_object_id() ) ) :
        echo \'<div class="single-featured-image-header">\';
        echo get_the_post_thumbnail( get_queried_object_id(), \'twentyseventeen-featured-image\' );
        echo \'</div><!-- .single-featured-image-header -->\';
    endif;
    ?>
    <div class="site-content-contain">
       <div id="content" class="site-content">
这是我的职能。js公司

/***针对2017年的功能。**提供帮助函数以增强主题体验*/

( function( $ ) {
    var body    = $( \'body\' ),
        _window = $( window ),
        nav, button, menu;

    nav = $( \'#site-navigation\' );
    button = nav.find( \'.menu-toggle\' );
    menu = nav.find( \'.nav-menu\' );

    /**
     * Adds a top margin to the footer if the sidebar widget area is higher
     * than the rest of the page, to help the footer always visually clear
     * the sidebar.
     */
    $( function() {
        if ( body.is( \'.sidebar\' ) ) {
            var sidebar   = $( \'#secondary .widget-area\' ),
                secondary = ( 0 === sidebar.length ) ? -40 : sidebar.height(),
                margin    = $( \'#tertiary .widget-area\' ).height() - $( \'#content\' ).height() - secondary;

            if ( margin > 0 && _window.innerWidth() > 999 ) {
                $( \'#colophon\' ).css( \'margin-top\', margin + \'px\' );
            }
        }
    } );

    /**
     * Enables menu toggle for small screens.
     */
    ( function() {
        if ( ! nav || ! button ) {
            return;
        }

        // Hide button if menu is missing or empty.
        if ( ! menu || ! menu.children().length ) {
            button.hide();
            return;
        }

        button.on( \'click.twentyseventeen\', function() {
            nav.toggleClass( \'toggled-on\' );
            if ( nav.hasClass( \'toggled-on\' ) ) {
                $( this ).attr( \'aria-expanded\', \'true\' );
                menu.attr( \'aria-expanded\', \'true\' );
            } else {
                $( this ).attr( \'aria-expanded\', \'false\' );
                menu.attr( \'aria-expanded\', \'false\' );
            }
        } );

        // Fix sub-menus for touch devices.
        if ( \'ontouchstart\' in window ) {
            menu.find( \'.menu-item-has-children > a, .page_item_has_children > a\' ).on( \'touchstart.twentyseventeen\', function( e ) {
                var el = $( this ).parent( \'li\' );

                if ( ! el.hasClass( \'focus\' ) ) {
                    e.preventDefault();
                    el.toggleClass( \'focus\' );
                    el.siblings( \'.focus\' ).removeClass( \'focus\' );
                }
            } );
        }

        // Better focus for hidden submenu items for accessibility.
        menu.find( \'a\' ).on( \'focus.twentyseventeen blur.twentyseventeen\', function() {
            $( this ).parents( \'.menu-item, .page_item\' ).toggleClass( \'focus\' );
        } );
    } )();

    /**
     * @summary Add or remove ARIA attributes.
     * Uses jQuery\'s width() function to determine the size of the window and add
     * the default ARIA attributes for the menu toggle if it\'s visible.
     * @since Twenty Thirteen 1.5
     */
    function onResizeARIA() {
        if ( 643 > _window.width() ) {
            button.attr( \'aria-expanded\', \'false\' );
            menu.attr( \'aria-expanded\', \'false\' );
            button.attr( \'aria-controls\', \'primary-menu\' );
        } else {
            button.removeAttr( \'aria-expanded\' );
            menu.removeAttr( \'aria-expanded\' );
            button.removeAttr( \'aria-controls\' );
        }
    }

    _window
        .on( \'load.twentyseventeen\', onResizeARIA )
        .on( \'resize.twentyseventeen\', function() {
            onResizeARIA();
    } );

    /**
     * Makes "skip to content" link work correctly in IE9 and Chrome for better
     * accessibility.
     *
     * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
     */
    _window.on( \'hashchange.twentyseventeen\', function() {
        var element = document.getElementById( location.hash.substring( 1 ) );

        if ( element ) {
            if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {
                element.tabIndex = -1;
            }

            element.focus();
        }
    } );

    /**
     * Arranges footer widgets vertically.
     */
    if ( $.isFunction( $.fn.masonry ) ) {
        var columnWidth = body.is( \'.sidebar\' ) ? 228 : 245;

        $( \'#secondary .widget-area\' ).masonry( {
            itemSelector: \'.widget\',
            columnWidth: columnWidth,
            gutterWidth: 20,
            isRTL: body.is( \'.rtl\' )
        } );
    }
} )( jQuery );
我不明白为什么响应菜单没有打开。请帮帮我。

1 个回复
最合适的回答,由SO网友:signal2013 整理而成

代码中的这一行button.on( \'click.twentyseventeen\', function() { 应该是:

button.on( \'click\', function() {

这个.twentyseventeen 附加到一些事件名称之后。我不敢肯定这是必要的。你能核实一下吗?