jQuery UI 手风琴激活 [英] jQuery UI Accordion activate

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

问题描述

我不知道如何做到这一点,或者我是否能做到这一点.我有一个 jQuery UI 手风琴,有多个部分,每个部分包含多个锚标记,每个标记都有一个唯一的字符串 id.

I'm not getting how to do this, or if I can do this. I have a jQuery UI Accordion, multiple sections with each section containing multiple anchor tags each with a unique string id.

我希望能够将手风琴打开到具有给定 id 的特定元素所在的位置.就像说iditem117".我可以使用类似

I'd like to be able to have the accordion open to where a particular element with a given id is. Like say id "item117". Can I use something like

$('#accordion').activate('activate','#item117');

甚至

$('#accordion').activate('activate',117);

我已经尝试了这些和一些变体,但无法实现.如果我想开始工作,手风琴应该已经打开到第二部分的结尾.

I've tried those and some variations but can't get it to go. In the case I was trying to get working, the accordion should've opened to the end of the second section.

我还是没明白,所以也许我做错了什么.我已经把它简化为一个示例页面:http://www.ofthejungle.com/testaccordion.php 请看一下它和它的来源.

I'm still not getting this, so maybe I'm doing something else wrong as well. I've stripped it down to an example page here: http://www.ofthejungle.com/testaccordion.php Please have a look at it and its source.

推荐答案

来自文档:

// getter
var active = $( ".selector" ).accordion( "option", "active" );

// setter
$( ".selector" ).accordion( "option", "active", 2 );

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

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