0
標題腳本部分。jQuery手風琴活躍的網址?
$(document).ready(function(){
var show_link = '/hr/resitration'; // That is current url.
var accordion = $("#accordion");
active = ???? // How to found activ url???
accordion.accordion({
header: "h3",
active: active,
autoHeight: false
});
});
在HTML部分
<div id="accordion">
<h3><a href="#">Dashboard</a></h3>
<div>
<ul>
<li><a href="/dashboard/my" >My works</a></li>
<li><a href="/dashboard/send" >Send works</a></li>
</ul>
</div>
<h3><a href="#">HR</a></h3>
<div>
<ul>
<li><a href="/hr/resitration?add=true" >Add Staff</a></li>
<li><a href="/hr/resitration" >Staff list</a></li>
<li>Config
<ul>
<li><a href="/hr/schools" >Schools</a></li>
<li><a href="/hr/role" >Roles</a></li>
</ul>
</li>
</ul>
</div>
</div>
活躍= accordion.find( 「一[HREF =」 + show_link +「] 「)。家長(」 DIV「)分組(); //這對我有用。謝謝。 – Ankhaa 2010-11-13 10:25:01
我必須設置'collapsible:true'和'navigation:true',然後'active = accordion.find(「a [href =」+ show_link +「]」)。parents(「div」).prev();'也爲我工作。 – ewernli 2011-02-07 19:26:42