问题
I guess you all know by now easyacordion:
http://www.madeincima.eu/blog/jquery-plugin-easy-accordion/
but i just find the documentation invisible for this..
lets say i have my acordion:
<div id="intro_web">
<dt>una</dt> <dd>descripcion una</dd>
<dt>dos</dt> <dd>descripcion una</dd>
<dt>dos</dt> <dd>descripcion una</dd>
</div>
and i want to have, separately, buttons to handle the accordion, like:
<a href="" onclick="acordion_slide(1)">una</a>
<a href="" onclick="acordion_slide(2)">dos</a>
<a href="" onclick="acordion_slide(3)">dos</a>
So, how would:
function acordion_slide(num){
// slide and jump acordion to slidenum = num
return false
}
this should look if i SET the accordion (on document ready) like this???
$('#intro_web').easyAccordion({
autoStart: true,
slideInterval: 6000
});
回答1:
I haven't used the mentioned plugin, but you could probably emulate a click on the desired item like this:
function acordion_slide(num){
$($("#intro_web dt").get(num)).click();
return false;
}
回答2:
Give a unique class to all slides. Lets say: Slide 1 gets class="spine_1, slide 2 gets class="spine_2", etc.
Now you can easily active a particular slide. To activate slide 5: $("dt.spine_5").activateSlide();
来源:https://stackoverflow.com/questions/5492258/easyacordion-jump-to-desired-slidenum-jquery-plugin