我在我的角度js项目的模板中使用语义ui手风琴。
<div class="ui accordion">
<div class="active title">
<i class="dropdown icon"></i>
What is a dog?
</div>
<div class="active content">
<p>A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.</p>
</div>
<div class="title">
<i class="dropdown icon"></i>
Content
</div>
<div class="active content">
<p>A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.</p>
</div>
</div>
问题是内容都处于打开状态,没有必要点击手风琴打开。我需要做些什么改变?
答案 0 :(得分:3)
您可以检查以下四项内容:
1)删除“活跃”&#39;来自标记中最后一个div的类,因为它使其内容可见。
2)您需要通过
初始化手风琴$('.ui.accordion').accordion();
请参阅Semantic UI accordion页面上的使用信息: http://semantic-ui.com/modules/accordion.html#/usage
3)您还需要包含Semantic UI javascript文件。
4)由于你说你在模板中使用了手风琴,你必须将初始化包装在模板内的脚本中,或者(角度方式)写一个短指令,它将为你调用元素上的手风琴初始化。