jQuery手风琴从外部链接激活 [英] Jquery accordion activate from external links

查看:91
本文介绍了jQuery手风琴从外部链接激活的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从外部链接打开某些J查询UI手风琴节时遇到很多麻烦.我正在通过超链接调用表单函数.

I am having a lot of trouble trying to open certain J query UI accordion sections from external links. I am calling form functions from hyperlinks.

链接是打开的部分,但随后它们单击回到原始位置.任何帮助将非常感激.这里是源.

Links are opening sections but then they click back to original position. any help would be much appreciated. Here the source.

<script>
    $(function() {
        $( "#accordion" ).accordion({
            autoHeight: false,
        });
    });
</script>


<script>
function Clicked1(){  
$("#accordion").accordion('activate' , 0)
 } 

 function Clicked2(){  
$("#accordion").accordion('activate' , 1)
 } 

</script>


<div class="demo">

<a href="" onclick="Clicked1()">OPEN1</a>
<a href="" onclick="Clicked2()">OPEN2</a>



<div id="accordion">
    <h3>< href="#section1" >Section 1</a></h3>
    <div>
        <p>Mauris mauris ante, blandit et, ultrices a, susceros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
    </div>

</div>

</div><!-- End demo -->

推荐答案

基于手风琴的API,您应该使用:

Based on the API of accordion, you should use:

$( "#accordion" ).accordion({ active: 2 });

http://docs.jquery.com/UI/Accordion

这篇关于jQuery手风琴从外部链接激活的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆