Cufon 和 IE6/7/8 的问题
我正在对这个网站进行重新设计,但是 Cufon 遇到了一个奇怪的问题。它与 H1、H2 等 html 元素配合得很好,但与 #ID 和类根本不起作用。
任何人都可以提供任何想法吗?提前致谢。
I'm working on a reskin of this site, but having an odd problem with Cufon. It's working perfectly well with html elements such as H1, H2 etc but not working at all with #ID's and classes.
Can anyone offer any thoughts? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没问题,这个很容易修复。只需在文档头部重新排序脚本标签即可。 jQuery 需要在 cufon 之前加载。
说明:如果未检测到像 jQuery 这样的库,Cufon 将尝试使用浏览器的本机
document.getElementsByTagName
,即使该库是在之后加载的库丰加载。通过首先加载 jQuery,Cufon 将检测到它,并且对Cufon.replace();
的所有调用都将使用 jQuery。顺便说一句,神圣的外部 HTTP 请求蝙蝠侠!
出于性能原因,您确实应该将它们编译到单个脚本文件中。您应该会看到页面下载时间减少了一个数量级(估计)。您可能还想改用 Google 托管的 CDN jQuery 库。
另外,看起来您正在使用带有 LiveQuery 插件的 jQuery 1.3。 jQuery 1.4 应该能够处理所有事情,而不需要插件。
旁注#2:
所有类似的 Cufon 方法调用都可以合并为一个,这也会表现得更好:
No problem, this one's easy to fix. Just re-order your script tags in the head of the document. jQuery needs to be loaded before cufon.
Explanation: Cufon will try to use the browser's native
document.getElementsByTagName
if a library like jQuery is not detected, even if the library is loaded after Cufon loads. By loading jQuery first, Cufon will detect it, and all of your calls toCufon.replace();
will use jQuery.On a side note, Holy External HTTP Requests Batman!
You should really compile those into a single script file for performance reasons. You should see page download times reduced by an order of magnitude (guesstimate). You may also want to switch to using Google's hosted CDN jQuery library.
Also, it looks like you're using jQuery 1.3 w/ the LiveQuery plugin. jQuery 1.4 should be able to handle everything without the need of a plugin.
Side Note #2:
All of your similar Cufon method calls can be combined into a single one, and this will also perform better: