我的accodion-toggle有问题。我把它放在我的代码中,但它没有工作我的标题保持蓝色,没有任何接近我的标题。
这是我的代码:
@{string module_origine = "";
int step = 0;
}
<div class="accordion" id="accordion2">
@foreach (var test in Model)
{
if (module_origine != test.module)
{
module_origine = test.module;
step = step + 1;
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse_@step">
@Html.DisplayFor(ModelItem => test.module)
</a>
</div>
<div id="Collapse_@step" class="accordion-body collapse in">
<div class="accordion-inner ">
@foreach (var item in Model.Where(item => item.module == module_origine))
{
<form method="get" action="/@Html.DisplayFor(modelItem =>item.droit)">
<button type="submit" class="btn btn-primary" title="@Html.DisplayFor(ModelItem => item.description)">@Html.DisplayFor(modelItem => item.menunom)</button>
</form>
}
</div>
</div>
</div>
}
}
</div>
我不明白为什么我的班级手风琴 - 切换不起作用所以我希望我能理解为什么并帮助我认为你!
答案 0 :(得分:1)
要获得一个面板,只需改变它:
@{string module_origine = "";
int step = 0;
}
**<div class="panel-group" id="accordion">** //add that to create panel
@foreach (var test in Model)
{
if (module_origine != test.module)
{
module_origine = test.module;
step = step + 1;
<div class="panel panel-success ">
<div class="panel-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse_@step">
@Html.DisplayFor(ModelItem => test.module)
</a>
</div>
<div id="Collapse_@step" class="accordion-body collapse in">
<div class="accordion-inner ">
@foreach (var item in Model.Where(item => item.module == module_origine))
{
<form method="get" action="/@Html.DisplayFor(modelItem =>item.droit)">
<button type="submit" class="btn btn-primary" title="@Html.DisplayFor(ModelItem => item.description)">@Html.DisplayFor(modelItem => item.menunom)</button>
</form>
}
</div>
</div>
</div>
}
}
</div>
我只是删除了手风琴的内容,而不是嘲笑我的东西