我有一个导航,你可以在这里看到:http: //hutchcreative.co.uk/rod/
如果您单击菜单图标(右上角),则会显示深色导航菜单。如果您单击联系我们,则会显示白色的联系我们部分。然后单击菜单图标关闭所有内容。如果您然后再次单击菜单图标,它会像以前一样打开深色导航,但如果您单击联系人,它不会打开。您必须再次单击它才能打开白色联系人部分。有谁知道如何解决这个问题?
这是我的jQuery:
jQuery(function($) {
$('#menuIcon').toggle(function(){
$('#navigationWrapper ul').hide();
$('#navigationWrapper ul').show();
$("#navigationWrapper").css("background-color", "rgba(0,0,0,0.3)");
},function(){
$('#navigationWrapper ul').show();
$('#navigationWrapper ul').hide();
$("#navigationWrapper").css("background-color", "rgba(0,0,0,0.0)");
});
$('#menu-item-56').toggle(function(){
$('#contactWrapper').hide();
$('#contactWrapper').show();
$("#navigationWrapper").addClass('whiteSection');
$("#navigationWrapper").css("background-color", "rgba(255,255,255,1)");
},function(){
$('#contactWrapper').show();
$('#contactWrapper').hide();
$("#navigationWrapper").removeClass('whiteSection');
$("#navigationWrapper").css("background-color", "rgba(0,0,0,0.3)");
});
$("#menuIcon").click(function ( event ) {
event.preventDefault();
$('#contactWrapper').hide();
$("#navigationWrapper").removeClass('whiteSection');
if($('#contactWrapper').is(":visible")) { $('#contactWrapper').hide(); }
});
});
这是我的html
<nav id="navigationWrapper">
<div class="container">
<div class="row">
<div class="span6">
<div id="logo"></div>
</div>
<div class="span6">
<div id="menuIcon"></div>
<ul>
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'container' => false, 'menu_class' => 'menu', 'menu_id' => 'menu', 'depth' => 1, 'fallback_cb' => '', 'items_wrap' => '%3$s' ) ); ?>
<?php get_template_part( 'part', 'social' ); ?>
</ul>
</div>
</div>
</div>
</nav>
<div id="contactWrapper" >
<div class="container">
<div class="row">
<?php
// query for the about page
$your_query = new WP_Query( 'pagename=contact' );
// "loop" through query (even though it's just one page)
while ( $your_query->have_posts() ) : $your_query->the_post(); ?>
<div class="span6">
<?php the_title(); ?>
<?php the_content(); ?>
</div>
<div class="span6">
<?php the_field('email_address'); ?>
</div>
<?php endwhile;
// reset post data (important!)
wp_reset_postdata();
?>
</div>
</div>
</div>