我正在尝试使用accordion在我的一个用例中实现它。手风琴不能正常工作。当我点击标题时,它不会打开和关闭。
我的HTML代码:
<accordion close-others="true">
<accordion-group heading="Fruits">
<div class="section">
<ul><li>Apples</li><li>Mango</li><li>Ban</li></ul>
</div>
</accordion-group>
<accordion-group heading="Animals">
<div class="section">
<ul><li>Dog</li><li>Rat</li><li>Cat</li></ul>
</div>
</accordion-group>
<accordion-group heading="Test">
<div class="section">
<ul><li>Test1</li><li>Test2</li><li>Test3</li></ul>
</div>
</accordion-group>
</accordion>
我在我的脚本中包含了accordion.js文件。
我是否遗漏了要在我的项目中添加的任何其他文件?
答案 0 :(得分:0)
我知道您受到上述代码的影响。您没有完整的源代码库。
看一看这个小小的想法......
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<h4 ><a data-toggle="collapse" data-parent="#accordion" href="#collapseage"><i class="fa fa-plus-square-o"></i> Age</a></h4>
<p class="clearfix"/>
<div id="collapseage" class="collapse out">
<ul class="list-inline">
This is very simple way of accordian....
<li><span>1. 0-15</li>
<li><span>2. 15-25</span></li>
<li><span>3. 25-35</span></li>
<li><span>4. 35-50</span></li>
</ul>
</div>
<h4 ><a data-toggle="collapse" data-parent="#accordion" href="#fruit"><i class="fa fa-plus-square-o"></i> Fruit</a></h4>
<p class="clearfix"/>
<div id="fruit" class="collapse out">
<ul class="list-inline"><li><span>Apples</span></li><li>Mango</li><li>Ban</li></ul>
</div>
<h4><a data-toggle="collapse" data-parent="#accordion" href="#animals"><i class="fa fa-plus-square-o"></i> Animals</a></h4>
<p class="clearfix"/>
<div id="animals" class="collapse out">
<ul class="list-inline"><li>Dog</li><li>Rat</li><li>Cat</li></ul>
</div>
<h4 ><a data-toggle="collapse" data-parent="#accordion" href="#test"><i class="fa fa-plus-square-o"></i> Test</a></h4>
<p class="clearfix"/>
<div id="test" class="collapse out">
<ul class="list-inline"><li>Test1</li><li>Test2</li><li>Test3</li></ul>
</div>
</body>
</html>
&#13;
答案 1 :(得分:-1)
如果您对此感到困惑,可以使用像...这样的引导方式。
<div class="age-lists df-demography-cat">
<div class="demography-htag df-inhtag">
<h4 class=" arvo-bold ft-14 pull-left"><a data-toggle="collapse" data-parent="#accordion" href="#collapseage"><i class="fa fa-plus-square-o"></i> Age</a></h4>
<input class="switch-handle" type="checkbox" checked>
</div>
<p class="clearfix"></p>
<div id="collapseage" class="collapse out">
<ul class="list-inline">
<li><span>0-15</span></li>
<li><span class="selected fa">15-25</span></li>
<li><span>25-35</span></li>
<li><span>35-50</span></li>
</ul>
<span class="add-more-dfbtn"><button type="button" class="btn-default small">add more</button></span>
</div>
</div>
这非常简单,仅适用于内部页面内容引用的崩溃进/出。 如图所示