我正在尝试在 Wordpress 上为我的博客制作响应式布局,但我无法克服移动设备上导航栏的问题。
<header class="span8" id="top-header">
<nav class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a data-target=".nav-collapse" data-toggle="collapse" class="btn btn-navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<?php
wp_nav_menu(array(
'menu' => 'Top menu',
'menu_class' => 'nav'
));
?>
<ul class="nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Categories <b class="caret"></b></a>
<ul class="dropdown-menu">
<?php
$args = array(
'exclude' =>'1',
'orderby' =>'name',
'order' => 'ASC'
);
foreach(get_categories($args) as $category): ?>
<li><a href="<?php echo get_category_link($category->term_id); ?>" title="Category: <?php echo $category->name; ?>"><?php echo $category->name; ?></a></li>
<?php endforeach; ?>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('title'); ?> - Back to the homepage">
<hgroup class="row-fluid">
<?php if(is_single()):?>
<h2 class="like-h1">My blog</h2>
<?php else: ?>
<h1>My blog</h1>
<?php endif; ?>
<h2>Bla bla bla</h2>
</hgroup>
</a>
</header>
在移动设备上,下拉菜单不像 Twitter Bootstrap 的示例那样工作,但它显示了导航栏中的每个链接。它不切换。你可以在这里看到它:我的博客示例