0
我已經使用Soh Tanaka的Simple Accordion tutorial成功構建了一個JQuery手風琴。我希望能夠從另一頁面鏈接到特定的手風琴部分,但我不知道如何做到這一點。任何幫助將不勝感激,因爲我沒有多少運氣找到任何特定於本教程的幫助。謝謝!如何鏈接到不同頁面的特定手風琴部分?
HTML:
<h2 class="acc_trigger"><a href="#">Web Design & Development</a></h2>
<div class="acc_container">
<div class="block">
<!--Content Goes Here-->
</div>
</div>
JQuery的:
//Set default open/close settings
$('.acc_container').hide(); //Hide/close all containers
$('.acc_trigger:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container
//On Click
$('.acc_trigger').click(function(){
if($(this).next().is(':hidden')) { //If immediate next container is closed...
$('.acc_trigger').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
$(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
}
return false; //Prevent the browser jump to the link anchor
});
謝謝 - 我會記住JQuery UI版本! – Lisa 2011-05-19 08:22:12