Cufon 悬停在鼠标移开时保持悬停状态
将鼠标悬停在按钮上。我想要的是 cufon 文本更改为 #e90c00。 由于某种原因(有时),当我将鼠标从按钮上移开时,它会保持#e90c00。
这是我使用的代码:
Cufon.replace('#nav li a span', { hover: true, hoverables: { span: true}, textShadow: '#353535 1px 1px'} );
有谁知道我该如何解决这个问题?
Hover the buttons. What i want is that the cufon text changes to #e90c00.
For some reason (sometimes) when i move my mouse off the button it stays #e90c00.
This is the code that i use:
Cufon.replace('#nav li a span', { hover: true, hoverables: { span: true}, textShadow: '#353535 1px 1px'} );
Does anyone know how i can fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我来到这篇文章寻找解决子菜单的 cufon 悬停问题。我对答案印象深刻,并尝试重置但无济于事。 cufon 常见问题解答中的以下文章可能会帮助其他人寻找类似的内容:
https: //github.com/sorccu/cufon/wiki/FAQ#wiki-faq-10
I came to this post looking for troubleshooting the cufon hover problem with submenu's. I was impressed with the answers and tried the reset to no avail. The following article from the cufon FAQ may help others looking for something similar:
https://github.com/sorccu/cufon/wiki/FAQ#wiki-faq-10
看看这个:https://github.com/sorccu/cufon/wiki/styling
你可以尝试一些测试
Check this out: https://github.com/sorccu/cufon/wiki/styling
some tests you can try
您需要调用 Cufon.refresh();例如:
You need to call Cufon.refresh(); eg:
为什么不使用CSS?
why not use CSS??
解决了问题:
Solved the issue:
一些用户建议的 jQuery 脚本实际上是让它正常工作的唯一方法。 Cufon 文档中解释的 Cufon 样式效果确实有效,但有时将鼠标移出按钮区域后,悬停效果仍会显示。这当然是一种耻辱。您至少需要在触发悬停后插入 Cufon.refresh() 或 Cufon.replace() 。您可以使用 CSS 保留样式,无需在 JS 片段中实现。这是我在这种情况下使用的代码:
当然,对于 CSS,类似的东西:
The jQuery script that some users have suggested is in fact the only way to get it to work properly. The Cufon styling effects that are explained in Cufon's documentation do work, but sometimes the hover effect will still display after you moved the mouse out of the button area. Which is, of course, a shame. You need at least to insert a Cufon.refresh() or Cufon.replace() after the hover is triggered. You can keep the styling with CSS, no need to implement that in the JS snippet. Here is the code I use for that case :
With CSS, of course, something like that :
较短的片段:
Shorter snippet: