jQuery Accordion - 设置“活动面板”负载期间
有一个奇怪的问题,我“认为”我知道问题是什么,但不知道如何解决。
我有一个包含 jQueryUI Accordion 的页面,我试图在运行时设置“Activate”,但只有在放置“Alert();”时才能使其正常工作。前!
我确实有许多 getJSON 调用来填充 Accordion 的内容(确定它必须有多少个面板),一旦完成,就需要跳转到适当的面板。
实际的调用在这里:
function jumpToAccordionDate(d,m,y){
var el3=$('#h'+d + m + y);
$('#accordion').accordion('activate',el3);}
以前,在创建手风琴期间,我已经通过以下方式设置了 H3 元素的 id:
$('#accordion').append('<h3 id="h' + dd + '"><a href="#">' + cDate + '</a></h3><div id="div' + dd + '"></div>').accordion('destroy').accordion();
是否有某种方式,也许在调用之前等待手风琴在 DOM 上完全完成渲染JumpToAccordionDate,或者有更好的替代方案吗?
Having a strange issue that I 'think' I know what the problem is but don't know how to resolve it.
I have a page that contains a jQueryUI Accordion, I'm trying to set the "Activate" during runtime, but I can only get this to work if I put an "Alert();" before!
I do have a number of getJSON calls that populates the contents of the Accordion (determines how many panels it has to have) and once this is complete then needs to jump to the appropriate panel.
The actual call is here:
function jumpToAccordionDate(d,m,y){
var el3=$('#h'+d + m + y);
$('#accordion').accordion('activate',el3);}
Previously, during the creation of the accordion, I've already set the id of the H3 element by the following:
$('#accordion').append('<h3 id="h' + dd + '"><a href="#">' + cDate + '</a></h3><div id="div' + dd + '"></div>').accordion('destroy').accordion();
Is there someway of, maybe waiting for the Accordion to totally finish rendering on the DOM before I call the jumpToAccordionDate, or is there a better alternate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为
create
事件可能会解决您的计时问题。该文档有点模糊,但您可以像这样使用它:I think the
create
event might solve your timing issue. The documentation is a little vague, but you could tap into it like this: