您好我遇到了以下问题: 当我尝试在Drupal中使用我的bootstrap subtheme并且我缩小窗口时,下拉按钮会像往常一样出现。但它不起作用。如果我点击它,就没有任何反应。有没有办法调试这个,以便我可以看到错误所在?
我已经做过的事情:包括transition.js和collapse.js。 Jquery是1.8。代码似乎是正确的,但是这里是例子:
我的page.tpl.php:
<header id="navbar" role="banner" class="<?php print $navbar_classes; ?>">
<div class="container">
<div class="navbar-header">
<?php if ($logo): ?>
<a class="logo navbar-btn pull-left" href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>">
<img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
</a>
<?php endif; ?>
<?php if (!empty($site_name)): ?>
<a class="name navbar-brand" href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>"><?php print $site_name; ?></a>
<?php endif; ?>
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<?php if (!empty($primary_nav) || !empty($secondary_nav) || !empty($page['navigation'])): ?>
<div class="navbar-collapse collapse">
<nav role="navigation">
<?php if (!empty($primary_nav)): ?>
<?php print render($primary_nav); ?>
<?php endif; ?>
<?php if (!empty($secondary_nav)): ?>
<?php print render($secondary_nav); ?>
<?php endif; ?>
<?php if (!empty($page['navigation'])): ?>
<?php print render($page['navigation']); ?>
<?php endif; ?>
</nav>
</div>
<?php endif; ?>
</div>
</header>
<div class="main-container container">
<header role="banner" id="page-header">
<?php if (!empty($site_slogan)): ?>
<p class="lead"><?php print $site_slogan; ?></p>
<?php endif; ?>
<?php print render($page['header']); ?>
</header> <!-- /#page-header -->
<div class="row">
<?php if (!empty($page['sidebar_first'])): ?>
<aside class="col-sm-3" role="complementary">
<?php print render($page['sidebar_first']); ?>
</aside> <!-- /#sidebar-first -->
<?php endif; ?>
<section<?php print $content_column_class; ?>>
<?php if (!empty($page['highlighted'])): ?>
<div class="highlighted jumbotron"><?php print render($page['highlighted']); ?></div>
<?php endif; ?>
<?php if (!empty($breadcrumb)): print $breadcrumb; endif;?>
<a id="main-content"></a>
<?php print render($title_prefix); ?>
<?php if (!empty($title)): ?>
<h1 class="page-header"><?php print $title; ?></h1>
<?php endif; ?>
<?php print render($title_suffix); ?>
<?php print $messages; ?>
<?php if (!empty($tabs)): ?>
<?php print render($tabs); ?>
<?php endif; ?>
<?php if (!empty($page['help'])): ?>
<?php print render($page['help']); ?>
<?php endif; ?>
<?php if (!empty($action_links)): ?>
<ul class="action-links"><?php print render($action_links); ?></ul>
<?php endif; ?>
<?php print render($page['content']); ?>
</section>
<?php if (!empty($page['sidebar_second'])): ?>
<aside class="col-sm-3" role="complementary">
<?php print render($page['sidebar_second']); ?>
</aside> <!-- /#sidebar-second -->
<?php endif; ?>
</div>
</div>
<footer class="footer container">
<?php print render($page['footer']); ?>
</footer>
答案 0 :(得分:0)
我用这种方式来折叠任何东西
<div class="active_one"><a class="capsolation_link" href="javascript:void()"><strong>Any title text</strong></a></div>
<div class="collapsible_one" style="display: none;">any txt will be collabse</div>
同样在js文件中我设置了一个
// collabse menu link
jQuery('.collapsible_one').hide();
jQuery('.collapsible_one:nth-child(2)').show();
jQuery('.active_one').attr('href', 'javascript:void(0)');
jQuery('.active_one a').attr('href', 'javascript:void(0)');
jQuery('.active_one').click(function() {
jQuery(this).next().slideToggle();
});
祝你好运