easyacordion jump to desired slideNum - Jquery Plugin

£可爱£侵袭症+ 提交于 2019-12-13 03:46:09

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!