打开带有函数的手风琴面板
好的,这是完整的代码,包含拼写更正和所有内容。我仍然收到错误。
父级的代码是:
$("#leftNav").accordion({autoHeight: true});
<div id="leftNav"> <h3><a href="#">Client</a></h3>
<div> static text </div>
<h3><a href="#">Account Summary</a></h3>
<div> static text </div>
<h3><a href="#"> Profile</a></h3>
<div> static text </div>
<h3><a href="#">trip</a></h3>
<div>
<div id="tripHolder">
</div>
</div>
iFrame 的代码:
$(".bookingClass").click(function(){
var thisBookingClass = 'bClass='+$(this).attr("id");
$.ajax({
type:"POST",
url:"bookIt.jsp",
data: thisBookingClass,
cache:false,
success: function(msg) {
$("#tripHolder",top.document).html(msg);
$("#leftNav",top.document).accordion('activate',3);
}
});
});
我在 fire bug 中遇到的错误现在是
$("#leftNav", top.document).accordion is not a function
ok here is the full code with the spelling corrections and everything. I am still getting an error.
code for parent is :
$("#leftNav").accordion({autoHeight: true});
<div id="leftNav"> <h3><a href="#">Client</a></h3>
<div> static text </div>
<h3><a href="#">Account Summary</a></h3>
<div> static text </div>
<h3><a href="#"> Profile</a></h3>
<div> static text </div>
<h3><a href="#">trip</a></h3>
<div>
<div id="tripHolder">
</div>
</div>
the code for the iFrame :
$(".bookingClass").click(function(){
var thisBookingClass = 'bClass='+$(this).attr("id");
$.ajax({
type:"POST",
url:"bookIt.jsp",
data: thisBookingClass,
cache:false,
success: function(msg) {
$("#tripHolder",top.document).html(msg);
$("#leftNav",top.document).accordion('activate',3);
}
});
});
The error I am getting in fire bug is now
$("#leftNav", top.document).accordion is not a function
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您在代码中拼写了 Accordion 错误。
编辑:
我有一个工作演示,可以在Firefox(在 IE6 中尝试过,但失败),仅当“client”标头是当前选择的标头时。您可以通过在 URL 中添加 /edit 来查看代码。
这似乎是一个棘手的问题,不幸的是我现在没有时间进一步研究它。为了防止出现错误,
我必须将对 jQuery UI 脚本的引用添加到 iframe 的源中。
似乎无法从 iframe 内部访问手风琴,我不确定原因。我让激活工作的方式非常hacky,基本上再次在
#leftNav
上调用.accordion()
,然后是.accordion('activate' ,3);
如下面的通知所示,我还使用了
parent.document
而不是top.document
- 后者不起作用,但通常在火狐。我希望它能让你走得更远。当我有更多时间时,我可能会回到这一点。
you've spelt accordion wrong in your code.
EDIT:
I have a Working Demo that works in Firefox (tried in IE6 but it failed), only if the "client" header is the one currently selected. You can see the code by adding /edit to the URL.
This seems to be a tricky problem to solve and unfortunately I don't have the time to look into it further at the moment. To prevent the error
I had to add a reference to the jQuery UI script to the source of the iframe.
It appears that the accordion becomes inaccessible from inside the iframe, the reason I'm not sure. The way that I got the activate to work was very hacky and basically called
.accordion()
on the#leftNav
again, followed by.accordion('activate',3);
as in the followingnotice that I also used
parent.document
instead oftop.document
- the latter wasn't working but normally does in Firefox.I hope it's got you a little further along. I may come back to this one when I have more time.
这可能是手风琴与手风琴的拼写错误吗?
Could it be the typo of accordion vs accordian?