停止 jquery 手风琴“活动”的切换行为打回来
$(#my-accordion).accordion('activate', N);
...打开手风琴的特定部分,行为不符合预期。它不会以编程方式“激活”该部分(强制其打开)。它只是切换手风琴的第 N 个部分。他们究竟为什么将这个功能称为“激活”而不是“切换”?!!!
有没有一种方法可以通过编程强制打开特定部分。我的手风琴塌了:是的。
=================
完整代码(简化):
//links
$("a.morelink.ethos").click
(
function()
{
loadSection("about");
$('#accordion-about').accordion('option', 'active', 0); //activate simply toggles. don't use it!
return false;
}
);
function loadSection(section)
{
//...blah blah blah
$("#about-div").show();
}
这是面板的结构:
<!-- about -->
<div id="panel-about">
<!-- content area -->
<div class="content about">
<ul id="accordion-about">
<li id="ethos">
<p class="caption"><a href="#">Our core ethos</a></p>
<div>Some content here</div>
</li>
<li id="history">
<p class="caption"><a href="#">Our History</a></p>
<div>Some content here</div>
</li>
<!-- more sections here.... -->
</ul>
</div>
</div>
$(#my-accordion).accordion('activate', N);
... to open a specific section of the accordion, the behaviour is not as expected. It does not 'activate' that section programmatically (force it to open). It simply toggles the Nth section of the accordion. Why on earth would they call this function 'activate' instead of 'toggle' ?!!!
Is there a way to programmably force a particular section to open. My accordion has collapsed:true.
=================
full code (simplified):
//links
$("a.morelink.ethos").click
(
function()
{
loadSection("about");
$('#accordion-about').accordion('option', 'active', 0); //activate simply toggles. don't use it!
return false;
}
);
function loadSection(section)
{
//...blah blah blah
$("#about-div").show();
}
And here is the structure of the panel:
<!-- about -->
<div id="panel-about">
<!-- content area -->
<div class="content about">
<ul id="accordion-about">
<li id="ethos">
<p class="caption"><a href="#">Our core ethos</a></p>
<div>Some content here</div>
</li>
<li id="history">
<p class="caption"><a href="#">Our History</a></p>
<div>Some content here</div>
</li>
<!-- more sections here.... -->
</ul>
</div>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用活动选项选择要激活的部分。
Use the active option to choose which section(s) to make active.