我一直在努力不使用崩溃动画。单击切换按钮时动画不起作用。 1秒后,整个菜单显示没有动画,类似于jQuery函数show()
这是我的代码:
<nav class="col-md-12 navbar navbar-static-top" role="navigation">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="container">
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav nav-justified main-nav">
<li class="menu-item current-menu-item"><a href="#">Home</a></li>
<li class="menu-item submenu"><a href="#">Submenu</a>
<ul>
<li>test</li>
<li>test</li>
<li>test</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
任何想法为什么会发生?
答案 0 :(得分:0)
以下是您的代码的mvce以及适用的库 - 根据Bootstrap规范,HTML的结构存在几个问题
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" aria-expanded="false"
data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" >
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home <span class="sr-only">(current)</span></a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
aria-haspopup="true" aria-expanded="false">
Submenu <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
这是一个简单的工作导航栏,取自Bootstrap's Docs on Collapse:
public partial class TableRow : ViewCell
{
public static readonly BindableProperty TextProperty =
BindableProperty.Create("Text", typeof(string), typeof(TableRow), null);
public string Text
{
get => (string)GetValue(TextProperty);
set
{
SetValue(TextProperty, value);
lblValue.Text = value;
}
}
我建议从文档中的标准模板开始,然后根据您的特定用例进行调整。