Jquery 手风琴从外部链接激活
我在尝试从外部链接打开某些 J 查询 UI 手风琴部分时遇到很多麻烦。我正在从超链接调用表单函数。
链接打开部分,但随后点击回到原始位置。任何帮助将不胜感激。这里是来源。
<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 -->
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 -->
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
基于accordion的API,您应该使用:
http://docs.jquery.com/UI/Accordion< /a>
Based on the API of accordion, you should use:
http://docs.jquery.com/UI/Accordion
我通过将实际标签放入您执行
onclick
的 href 中来使您的示例正常工作,如下所示:I made your example work by putting an actual tag into the href you did the
onclick
for, as:编写手风琴代码
Write accordion code