美好的一天。 我知道几年前在这个论坛上已经解决了类似的问题,但我仍然难以修复它。 这是(link to my test site)。
正如你所看到的,手风琴甚至不起作用,更少谈论从外部链接激活。我究竟做错了什么? 我将非常感谢您的帮助。谢谢。
javaascripts是
var $accordion = $("#accordion"),
panelId = parseInt(window.location.hash.replace(/#panel/, "")) || 0;
$accordion.accordion({
active: panelId
});
$(".opener").on("click", function () {
var $this = $(this),
toOpen = $this.data("panel");
$accordion.accordion("option", "active", toOpen);
return false;
});
html是
<code>
<a class="opener" data-panel="0" href="section1.html">Open Section 1</a>
<a class="opener" data-panel="1" href="section2.html">Open Section 2</a>
<a class="opener" data-panel="2" href="section3.html">Open Section 3</a>
<a class="opener" data-panel="3" href="section4.html">Open Section 4</a>
<div id="accordion">
<h3>Section 1</h3>
<div>
<p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo
ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
</div>
<h3>Section 2</h3>
<div>
<p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit
faucibus urna.</p>
</div>
<h3>Section 3</h3>
<div>
<p>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia
ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.</p>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3>Section 4</h3>
<div>
<p>Cras dictum. Pellentesque habitant morbi tristique senectus et netus et
malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus
orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel
est.</p>
<p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
inceptos himenaeos.</p>
</div>
</div>
</code>