当 css 加载到 body 中时,Jquery Colorbox 中断,是否可以修复?
目前我有一个相当复杂的 javascript 项目,99% 的资源都是通过 yepnope 加载的(包括 *.css、*.js)。现在读完这篇文章后:
http://groups.google.com/group/colorbox/ browser_thread/thread/850765cf0d64602a
看来Colorbox在页面加载时做了一些自我配置,并且需要将其放在头部中文档的内容,因此它会在页面之前加载。现在我知道这就是问题所在,这将是一个简单的修复,但是我想知道是否有一种方法可以将其加载到主体中并告诉它在我告诉它时配置自己,而不是页面加载时?
如果没有,那也不是世界末日,但我想我还是会问这个问题。
Currently I have a fairly complex javascript project and 99% of resources are loaded via yepnope (this includes *.css, *.js). Now after reading this:
http://groups.google.com/group/colorbox/browse_thread/thread/850765cf0d64602a
It appears that Colorbox does some self configuring when the page loads, and it is required to be put within the head of the document so it is loaded before the page. Now I know this is the issue and this would be a simple fix, however I was wondering if there is a way to load it in the body and tell it to configure itself when I tell it to, not when the page loads?
If not, its not the end of the world, but thought I would ask the question anyway.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
。这是不正确的,请将脚本放在您想要的任何位置。在执行脚本之前确实需要加载 CSS,因为它取决于其中的样式。
This is not true, put the script anywhere you want. The CSS does need to be loaded though before you execute the script, because it depends on the styles in it.