jquery Accordion:使用 Struts激活选项
我有一个 Struts 2 应用程序,它利用 Struts2 jQuery 插件的手风琴功能( http://code.google.com/p/struts2-jquery/wiki/AccordionTag),我正在尝试以编程方式遍历手风琴项目。我的意思是,我基本上希望在每个手风琴内容区域中有一个按钮,用于打开其下方的下一个手风琴项目。在我的 Struts 应用程序之外使用纯 jQuery,我似乎能够执行此操作:$("#accordion").accordion('activate', x);
,如下所述:jQuery UI Accordion activate
但是,当我尝试使用 struts jquery 实现执行此操作时,它会搞砸我的渲染完全手风琴。不幸的是,使用简单的 jQuery UI 对我来说似乎不是一个选择。对于我目前正在使用的内容,还有其他可能的方法吗?甚至可以使用 jQuery 来操作 struts 创建的 Accordion 对象吗?
任何帮助将不胜感激。我真的很想继续以这种方式使用手风琴,因为它非常易于使用,但我不确定它是否足够灵活以适合我的目的。
预先感谢您提供的任何建议。
I have a Struts 2 application that is utilizing the accordion feature of the Struts2 jQuery plugin (http://code.google.com/p/struts2-jquery/wiki/AccordionTag) and I'm trying to programmatically traverse through the accordion items. What I mean is that I basically want to have a button in each accordion content area that opens up the next accordion item below it. Using plain jQuery outside of my Struts application, I seem to be able to do this: $("#accordion").accordion('activate', x);
, as described here: jQuery UI Accordion activate
When i try to do this with my struts jquery implementation, however, it screws up the rendering of my accordion altogether. Unfortunately, using plain jQuery UI doesn't seem to be an option for me. Is there any other possible way to do this with what I'm currently working with? Is it even possible to use jQuery to manipulate the accordion object that struts created?
Any help would be greatly appreciated. I really want to continue using the accordion in this fashion because it's very easy to use, but I'm not sure that it's flexible enough to suit my purposes.
Thanks in advance for any advice you can provide.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这太棒了,我想我会与世界分享:)
我所要做的就是将此代码
$("#accordion").accordion('activate', 0);
添加到我的 sj:accordion 对象下方的区域。我的问题是,我将此代码放在文档的头部,但我假设渲染元素的时间存在差异,因此我只能在实际创建后引用该对象。现在我可以绑定按钮的单击事件来打开不同的手风琴项目。它就像一个魅力!this is so awesome, i figured i would share with the world :)
All i had to do was add this code
$("#accordion").accordion('activate', 0);
to an area below my sj:accordion object. My problem was that i was putting this code in the head of my document, but I'm assuming there is a difference in when the elements are rendered, therefore I can only reference this object after it's actually been created. Now I can bind the click event of buttons to open different accordion items. It's working like a charm!