通过找到的手风琴激活手风琴 [英] activate accordion by found accordion
本文介绍了通过找到的手风琴激活手风琴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 jquery ui文档中,有按索引激活手风琴的方法. br>
但是我想从找到手风琴"中激活.
在下面的代码或任何其他解决方案中,必须用 ???
替换什么
In jquery ui doc , there is method by index to activate accordion.
However I want to activate from "accordion found".
What must be replaced by ???
in code below, or any other solution
var accordion = $('.ui-accordion')
accordion.each(function () {
var hashHref = $.param.fragment(); //hashHref is the anchor href of relevant accordion
$(this).find("a[href='#" + hashHref + "']").???;
});
谢谢
推荐答案
with the help of this answer, this solves the case:
accordion.each(function () {
var hashHref = $.param.fragment();
var findElement = $(this).find("a[href='#" + hashHref + "']");
if (findElement.length) {
var ndx = $(findElement).parent().index() * 0.5;
$(this).accordion("activate", ndx);
}
});
这篇关于通过找到的手风琴激活手风琴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文