简体   繁体   中英

Colorbox doesn't open after two clicks

I'm having the weirdest issue with 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.

It opens just like a normal link

This is the behavior you get when there is a JavaScript error. 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. 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. The calling link was inside an update panel, while the jQuery that established the event handler was outside the panel. After the update panel refreshes, it would fail to open. By moving everything inside the update panel, I was able to make this work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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