我正在使用以下代码
jQuery(document).ready(function($) {
$("body").show();
$( "#accordion" ).accordion({
collapsible: true,
active: false,
header: '> div.my-accordion-section > h3',
heightStyle: 'content'
});
});
我想在h3之后添加另一个html标签作为标题中的副标题,我该怎么写呢?我试过了
header: '> div.my-accordion-section > h3, p',
在h3之后使用或不使用逗号
答案 0 :(得分:1)
这不是header
选项的工作原理。如果您希望字幕小于标题,请尝试:
HTML:
<div id="accordion">
<h3>Header 1 <span>Subtitle 1</span></h3>
<div> Ut gravida lobortis diam non varius. Duis tempor cursus justo ut consequat. Donec bibendum sem arcu, at placerat orci ultricies sed. </div>
<h3>Header 2 <span>Subtitle 2</span></h3>
<div> Praesent iaculis lacus quis elementum vulputate. </div>
<h3>Header 3 <span>Subtitle 3</span></h3>
<div> Phasellus ligula eros, interdum et posuere ut, dapibus ac tortor. </div>
</div>
CSS:
#accordion h3 span{
font-size: 50%;
vertical-align: middle
}
#accordion h3 span:before{
content: "- ";
}