简体   繁体   English

有哪些方法可以加快cufon的加载时间?

[英]What are some ways to speed up cufon's load time?

I'm using cufon for font replacement with jQuery for a site built on-top of drupal with a couple modules that tack on its own JS files. 我正在使用cufon用jQuery替换字体,这是一个在drupal之上构建的网站,其中包含几个附加在其自己的JS文件上的模块。 There seems to be a flicker in the text that I have cufon applied to. cufon所应用的文本中似乎有闪烁。 I'm profiling my JS in firebug and it looks like cufon is taking forever to load. 我正在Firebug中分析我的JS,看起来cufon永远需要加载。

A couple things that I've tried: 我尝试过的几件事:

  • adding cufon.now before the closing body tag 在结束body标签之前添加cufon.now
  • moved any cufon.replace from within $(document).ready() to including the bit of JS right after that element on the page. 将任何cufon.replace从$(document).ready()内移到页面上该元素之后的JS位置。

None of that seems to be helping the delay. 这些似乎都没有帮助延迟。 Does anybody have any suggestions? 有人有什么建议吗?

Sure there is, add this just before </body> tag: 当然可以,将它添加到</body>标记之前:

<script type="text/javascript"> Cufon.now(); </script>

Cufon.now will speed up the font loading, as well as prevent "flickering" Cufon.now将加快字体加载,并防止“闪烁”

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

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