简体   繁体   English

单击两次后,Colorbox无法打开

[英]Colorbox doesn't open after two clicks

I'm having the weirdest issue with colorbox. 我在colorbox中遇到了最奇怪的问题。 I click a link, and the modal window opens. 我单击一个链接,然后打开模式窗口。 I close the window. 我关上窗户。 I click the link again, and the window opens again. 我再次单击该链接,然后窗口再次打开。 Then I close the window again. 然后我再次关闭窗口。 All good so far. 到目前为止一切都很好。 Then, when I click the link again, the requested page opens, but not in the modal window. 然后,当我再次单击链接时,将打开请求的页面,但不在模式窗口中。 It opens just like a normal link, in the same window. 就像普通链接一样,它在同一窗口中打开。 I can repro this all day. 我可以整天重做。

Any ideas? 有任何想法吗? I'm not very familiar with colorbox or jscript. 我对colorbox或jscript不太熟悉。

It opens just like a normal link 就像普通链接一样打开

This is the behavior you get when there is a JavaScript error. 这是出现JavaScript错误时得到的行为。 There is no way anyone here is going to be able to determine what is causing the error without seeing a demonstration of the problem, because it really could be anything. 在这里,任何人都不可能在没有看到问题演示的情况下确定导致错误的原因,因为它实际上可能是任何东西。

One thing in particular that often causes problems is people loading complete HTML documents as ajax, rather than in an iframe. 特别经常引起问题的一件事是,人们将完整的HTML文档作为ajax而不是iframe加载。 This causes a lot of script conflicts as scripts for both documents are trying to work within the same global namespace. 这会导致很多脚本冲突,因为两个文档的脚本都试图在同一全局名称空间中工作。

@Jack ~ Your reply led me to the answer, which turned out to be much simpler than I thought. @Jack〜您的答复使我得到了答案,结果比我想的要简单得多。 The calling link was inside an update panel, while the jQuery that established the event handler was outside the panel. 调用链接在更新面板内部,而建立事件处理程序的jQuery在面板外部。 After the update panel refreshes, it would fail to open. 更新面板刷新后,将无法打开。 By moving everything inside the update panel, I was able to make this work. 通过将所有内容移动到更新面板中,我能够完成这项工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM