如何对厚盒的 AJAX 加载内容执行某些操作?
有我可以参加的活动吗?我已经浏览了文档,除非我周三的大脑无法正常工作,否则我看不到任何类似的内容。
我正在使用标准方式将 AJAX 内容加载到厚盒中(添加“thickbox”css 类),但是当加载它时,我想对某些加载的内容执行一些 jQuery 魔法。
我应该怎么办?
Id there an event I can hook into? I've looked through the docs, and unless my Wednesday brain is failing me I can't see anything along those lines.
I am loading AJAX content into a thickbox using the standard way (adding the "thickbox" css class), but when it's loaded I want to do some jQuery magic on some of the loaded content.
What should I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Thickbox 现在已经很老了,不符合标准的 jQuery 插件模式(例如提供选项、回调等)。一切都是通过查看锚属性来完成的。
您可以将其构建到源代码中,或者在其他地方寻找可以为您提供所需功能的灯箱。 Tinybox 也许?
另一种选择可能是使用 ajax 全局事件,例如 $.ajaxSuccess。然而,当这些事件被触发时,thickbox 将有机会渲染内容。您可以使用 setTimeout 但这不是一个好的解决方案。
Thickbox is quite old now and does not confirm to the standard jQuery plugin modal (e.g providing options, callbacks etc) Everything is done by looking at the anchor attributes.
You could build this into the source, alternatively look elsewhere for a lightbox that gives you the functionality you require. Tinybox maybe?
Another option maybe to use the ajax global events such as $.ajaxSuccess. However thickbox will have had chance to render the content when these events are fired. You could use a setTimeout but it is not a good solution imo.