简体   繁体   English

Cufon:悬停时更改字体粗细

[英]Cufon: changing font-weight on hover

I am using Cufon to embed <a> tags with the 'Print Clearly' typeface. 我正在使用Cufon嵌入带有“清晰打印”字体的<a>标签。

On the hover state of the <a> tag I would like the text to change to bold, how can I do this with Cufon? <a>标记的悬停状态下,我希望文本更改为粗体,如何使用Cufon做到这一点?

<script src="js/jquery-1.4.2.js" type="text/javascript"></script>
<script src="js/cufon-yui.js" type="text/javascript"></script>
<script src="js/print-clearly_400.font.js" type="text/javascript"></script> 
<script type="text/javascript">
   Cufon.replace('a', fontWeight: 'normal',
    hover: {
        fontWeight: 'bold'
    });
</script>

Note that you cannot add a hover effect to an element that has already been replaced. 请注意,您无法将悬停效果添加到已被替换的元素上。 You can, however, replace the hoverable element first and then the parent element after that. 但是,您可以先替换hoverable元素,然后再替换父元素。 The hover effect will still apply. 悬停效果仍然适用。

But you can setup it on load: 但是您可以在加载时进行设置:

Cufon('h1', {
    fontWeight: 'normal',
    hover: {
        fontWeight: 'bold'
    }
});

Further reading . 进一步阅读

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

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