Cufon IE 无效参数
好吧,我对这个有点难住了。我正在使用 Cufon 将我的文本替换为非网络标准字体。这是我用过很多次的脚本。过去从未遇到过问题。 IE 出现了,它决定毁了我的一天。
我正在使用最新版本的 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>
不确定如果这是引用多种不同字体的最佳方式,但它在所有浏览器(特别是我当前正在运行的v.8.0.7)中工作正常。 IE 给出如下错误报告:
网页错误详细信息:
消息:参数无效。 线路:7 字符:8520 代码:0 URI: http://localhost /wordpress/wp-content/themes/pondera/js/cufon/cufon-yui.js?ver=1.0.0
我调查了 Cufon js 文件,这似乎就在D.replaceChild
参考。现在我距离JS专家还很远,所以我不知道是什么导致了这个问题...
仅供参考,通过测试,我尝试删除第一个 Cufon.replace(...< /code> 参考(即上面的代码),看看这是否是我的糟糕编码,但这并没有解决它
任何建议将不胜感激!提前感谢您阅读本文,我会。如果需要的话,很乐意提供更多信息。
Okay, I'm a little stumped with this one. I am usng Cufon to replace my text with a non-web standard font. This is a script I've used an aweful lot & never had a problem with it in the past. Along comes IE and it decides to ruin my day.
I am using the most up to date version of cufon (as at the date of this post) and am reference a number of differnt elements in my header.php file (for a Wordpress site):
<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>
Not sure if this is the best way to reference multiple different fonts but it's working fine in all browsers bar IE (specifially v.8.0.7 which I'm currently running). IE gives the following error report:
Webpage error details:
Message: Invalid argument.
Line: 7
Char: 8520
Code: 0
URI: http://localhost/wordpress/wp-content/themes/pondera/js/cufon/cufon-yui.js?ver=1.0.0
I investigated the Cufon js file and this appears to be just before a D.replaceChild
reference. Now I am far from a JS expert so I have no idea what is causing this problem...
Just for reference, by way of a test, I attempted to remove all bar the first Cufon.replace(...
reference (i.e. the above code) to see if it was my poor coding but this didn't fix it.
Any suggestions would be greatly appreciated! Thanks in advance for readaing this, I'd be happy to provide more info should it be required.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我想我已经找到了一个灵魂(某种意义上)......并且可能是 Cufon 本身的一个错误(尽管如果我错了,我不会感到惊讶!)。
正如 Epascarello 所建议的,我证明了代码的布局可以减少脚本标签的数量:
在执行此操作时,我花了一些时间在插入代码时按顺序测试代码,以查看错误何时发生。在此期间,我测试了每个选择器和一切正常,其中之一... h4!?!?澄清一下,如果将上面代码中的第一行修改为以下内容,则会出现 IE 错误:
奇怪吧?!我使用的灵魂是修改我的标记以避免 H4 标签,但大概这是 Cufon 中的错误?
希望这对某人有帮助!
Okay I think I have found a soultion (of sorts)... and possibly a bug in Cufon itself (although I wouldn't be surprised if I was wrong!).
As Epascarello suggested, I'm proved the layout of my code to fewer script tags:
Whilst doing this I took some time to sequentially test the code as it was inserted to see when the error occured. During this I tested each selector & all worked bar one... h4!?!? To clarify if you amend the first linein the code above to the following, the IE error will occur:
Weird huh?! The soultion I'm using is to amend my markup to avoid the H4 tags but presumably this is an error in Cufon?
Hope this helps someone!