jQuery 手风琴 - 打开某些 div 的链接
我正在经历一场噩梦,试图让这个工作正常进行(并且已经查看了其他帖子,但仍然遇到问题)。
基本上我有一个这样的链接:
/test.php#bob
在 test.php 上我有这个:
<div class="accordion">
<h2>Customer care</h2>
<div>
<p>xxxxxxxxxxxxx</p>
</div>
<h2 id="bob">Strong leadership from start to finish</h2>
<div>
<p>fffffffffff</p>
</div>
<h2>Certainty of delivery, no matter how complex or difficult</h2>
<div>
<p>dddddddddd</p>
</div>
</div>
在 jQuery 中我有这个:
$(".accordion").accordion({
autoHeight: false,
collapsible: true,
navigation: true,
active: 'none'
});
但我仍然无法通过链接打开 #bob 面板。
有什么想法吗?我把我的头发拔出来。
一个。
I am having a nightmare trying to get this working (and have looked at other posts but am still having an issue).
Basically I have a link like this:
/test.php#bob
on test.php I have this:
<div class="accordion">
<h2>Customer care</h2>
<div>
<p>xxxxxxxxxxxxx</p>
</div>
<h2 id="bob">Strong leadership from start to finish</h2>
<div>
<p>fffffffffff</p>
</div>
<h2>Certainty of delivery, no matter how complex or difficult</h2>
<div>
<p>dddddddddd</p>
</div>
</div>
And in jQuery I have this:
$(".accordion").accordion({
autoHeight: false,
collapsible: true,
navigation: true,
active: 'none'
});
But I still cant get the #bob panel to open via the link.
Any ideas? Im pulling my hair out.
A.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以这样做:
这将在
上执行
click
(通过使用哈希,其中包括#
作为一个#id
选择器),调用标准手风琴行为。You can do it like this:
This would perform a
click
on the<h2>
(by using the hash, which includes the#
as an#id
selector), invoking the standard accordion behavior.