本文介绍了通过找到的手风琴激活手风琴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 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); } });更多推荐
通过找到的手风琴激活手风琴
发布评论