Jquery Accordion,由ID设置活动 [英] Jquery Accordion, Set Active by ID
本文介绍了Jquery Accordion,由ID设置活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< script>
jQuery(function(){
jQuery(#work).accordion({
collapsible:true,
active:1});
});
< / script>
所以现在第一个H3会打开,但我希望能够设置哪个div H3 id
< h3 id ='$ record [wid]'>
< a id ='clickable'href ='#'>
< div class ='workitem'>
< span class ='mosaic-overlay'>
< div class ='details'>
< a name ='$ record [wid]'>< / a>
< span class ='title'> $ record [title]
< / span>
< br />
< span class ='subtitle'> $ record [subtitle]
< / span>
< / div>
< / span>
< span class ='mosaic-backdrop'>
< img src ='/ img / work / $ record [image]'/>
< / span>
< / div>
< / a>
< / h3>
解决方案
在我使用的手风琴中,
< script type ='手风琴折叠的编号必须设置为h3#+文本/ JavaScript的'>
jQuery(function(){
jQuery(#work).accordion({
collapsible:true,
active:h3#id
}) ;
});
< / script>
我相信它是标准的jQueryUI手风琴,希望它也能适用于您。
So I have tried everything and cannot seem to figure this out, what I have is an accordian that plugs in data dynamicly, what I need to happen is I need the id of the data to be pluged in as the id for the h3 section that then is in turn clicked and opened...
<script>
jQuery(function() {
jQuery( "#work" ).accordion({
collapsible: true,
active: 1});
});
</script>
So right now the first H3 will be open, but I want to be able to set which div by the H3 id
<h3 id='$record[wid]'>
<a id='clickable' href='#'>
<div class='workitem'>
<span class='mosaic-overlay'>
<div class='details'>
<a name='$record[wid]'></a>
<span class='title'>$record[title]
</span>
<br />
<span class='subtitle'>$record[subtitle]
</span>
</div>
</span>
<span class='mosaic-backdrop'>
<img src='/img/work/$record[image]' />
</span>
</div>
</a>
</h3>
解决方案
On the accordion I use in my project, I just set the active to "h3#" + the id of the accordion fold I want to open.
<script type='text/javascript'>
jQuery(function() {
jQuery( "#work" ).accordion({
collapsible: true,
active: "h3#id"
});
});
</script>
I believe its the standard jQueryUI accordion, so hopefully it will work for you too.
这篇关于Jquery Accordion,由ID设置活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文