好吧,我对这个有点困惑。我使用Cufon来替换我的文本,用一个非web标准字体。这是一个脚本,我使用了很多令人敬畏的东西&在过去从未遇到过任何问题。随着我的到来,它决定毁掉我的一天。
我正在使用最新版本的cufon (截至本文发布日期),并在我的header.php文件中引用了许多不同的元素(用于Wordpress站点):
<script type="text/javascript" language="javascript" >Cufon.replace('.learnmore', { color: '#fff', textShadow: '1px 1px #0e1b0a', hover: { textShadow: '1px 1px #000', color: '#fff' } }); </script>
<script type="text/javascript" language="javascript" >Cufon.replace('.logo span, h1, h2, h4 , h5, h6, .learnmore, .prosto_button, .comment-reply-link, .slide_button, .page_title .bold p, .textonlycont, .h-title', { fontFamily: "Aller"}); </script>
<script type="text/javascript" language="javascript" >Cufon.replace('.h-title', { textShadow: '1px 2px #5C1003' }); </script>
<script type="text/javascript" language="javascript" >Cufon.replace('h1', { color: '-linear-gradient(white, #ececec)', textShadow: '#862905 0 2px'}); </script>
<script type='text/javascript' src='http://localhost/wordpress/wp-content/themes/pondera/js/cufon/Vegur.font.js?ver=1.0.0'></script>
<script type="text/javascript" language="javascript" >Cufon.replace('h3, #serv-benefit h4, p.quote, #letstalk label', { fontFamily: "Vegur"}); </script>
<script type="text/javascript" language="javascript" >Cufon.replace('#letstalk label', { fontFamily: "Vegur", textShadow: '1px 2px #293719' }); </script>不确定这是否是引用多个不同字体的最佳方式,但它在所有浏览器中都很好,只有IE (我目前正在运行的v.8.0.7 )。IE给出了以下错误报告:
网页错误详细信息:
消息:无效参数。行:7 Char: 8520代码:0 URI:http://localhost/wordpress/wp-content/themes/pondera/js/cufon/cufon-yui.js?ver=1.0.0
我研究了Cufon文件,这似乎就在D.replaceChild引用之前。现在我不是JS专家所以我不知道是什么导致了这个问题..。
作为参考,作为测试,我试图删除第一个Cufon.replace(...引用(即上面的代码)中的所有条,以查看它是否是我糟糕的编码,但这并没有修复它。
任何建议都将不胜感激!在此之前感谢您的阅读,如果需要的话我很乐意提供更多的信息。
发布于 2011-09-11 15:31:16
好吧,我想我找到了一种.而且可能是Cufon本身的一个bug (虽然如果我错了,我也不会感到惊讶)。
正如Epascarello所建议的那样,我被证明我的代码布局为更少的脚本标记:
<script type="text/javascript" language="javascript" >
Cufon.replace('.logo span, h1, h2, h5, h6, .learnmore, .prosto_button, .comment-reply-link, .slide_button, .page_title .bold p, .textonlycont, .h-title', { fontFamily: "Aller"});
Cufon.replace('h1', { color: '-linear-gradient(white, #ececec)', textShadow: '#862905 0 2px'});
Cufon.replace('.learnmore', { color: '#fff', textShadow: '1px 1px #0e1b0a', hover: { textShadow: '1px 1px #000', color: '#fff' }});
Cufon.replace('.h-title', { textShadow: '1px 2px #5C1003' });
</script>
<script type='text/javascript' src='http://localhost/wordpress/wp-content/themes/pondera/js/cufon/Vegur.font.js?ver=1.0.0'></script>
<script type="text/javascript" language="javascript" >
Cufon.replace('h3, #serv-benefit h4, p.quote, #letstalk label', { fontFamily: "Vegur"});
Cufon.replace('#letstalk label', { fontFamily: "Vegur", textShadow: '1px 2px #293719' });
</script>在执行此操作时,我花了一些时间对代码进行顺序测试,因为代码是插入的,以查看错误发生的时间。在这期间,我测试了每个选择器&所有的工作条一.h4!为了澄清如果您将上述代码的第一行修改为以下内容,将发生IE错误:
Cufon.replace('.logo span, h1, h2, h4, h5, h6, .learnmore, .prosto_button, .comment-reply-link, .slide_button, .page_title .bold p, .textonlycont, .h-title', { fontFamily: "Aller"});很奇怪吧?!我使用的解决方法是修改标记以避免使用H4标记,但这可能是Cufon中的一个错误吗?
希望这能帮到别人!
https://stackoverflow.com/questions/7320195
复制相似问题