如何在同一页面中具有多个jQuery颜色框 [英] How to have multiple jQuery colorboxes in the same page

查看:93
本文介绍了如何在同一页面中具有多个jQuery颜色框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面需要从多个位置打开一个颜色框.一种是在文档准备功能中,如下所示:

I have a page that needs to open a colorbox from multiple locations. One is in the document ready function as follows:

$("a[rel='q1']").colorbox({opacity:0.8, width:"800px", height:"75%"});

另一个需要从Google图表中打开一个完全不相关的颜色框,并在onclick函数中这样做:

The other needs to open a totally unrelated colorbox from a google chart and does so like this in an onclick function:

$.colorbox({maxHeight:"100%", href:'<c:url value="/path/mypage.html" />'});

如果我单击第二个,它将打开.然后单击第一个,它将打开.然后单击第二个,我得到以下javascript错误:

If I click the second one it opens. then click the first and it opens. Then click the second and I get the following javascript error:

Uncaught TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'colorbox'

当我单击第一个配置中的链接时,它将中断第二个配置,直到刷新页面为止.

As soon as I click the link in the first configuration it breaks the second until the page is refreshed.

colorbox 1.3.18 jQuery 1.6.4

colorbox 1.3.18 jquery 1.6.4

我怎样才能让他们两个都工作?

How can I get both of them to work?

推荐答案

听起来像您的第二个链接包含指向jQuery的链接,并且它覆盖了加载到文档中并使用colorbox插件扩展的jQuery的原始版本.我的猜测是第二个链接是一个完整的HTML文档,应显示为iframe而不是ajax.

Sounds like your 2nd link contains a link to jQuery, and it is overwriting the original version of jQuery that you load into your document and extend with the colorbox plugin. My guess is that the 2nd link is a complete HTML document, which should be displayed as an iframe rather than ajax.

这篇关于如何在同一页面中具有多个jQuery颜色框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆