鼠标移到链接上后 HTML 超链接的颜色保持不变
我想知道,当鼠标悬停在链接上时,链接会变成蓝色。是否可以让它们在鼠标移开后几秒钟保持蓝色?我猜这可以用 jquery 实现吗?谢谢!
I was wondering, I have links that change blue when a mouse hovers over them. Would it be possible to make them remain blue a few seconds after the mouse has moved away? I'm guessing this would be possible with jquery? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
另一种选择可能是CSS的transition-duration属性。这不会使其在指定时间内保持纯色,但它可以允许从一种颜色过渡到另一种颜色,例如需要几秒钟的时间。某些访问该页面的浏览器可能不支持此功能,因此使用 jQuery 的其他答案非常适合。
An alternative might be the CSS transition-duration property. This won't keep it a solid color for the specified time but it can allow a transition from one color to another to take a number of seconds for example. This may not be supported by some browsers visiting the page so the other answers using jQuery are great for that.
演示
css
html
jQuery
演示
demo
css
html
jQuery
demo
当然!如果您想让链接淡出,则需要 jQuery UI 来对颜色进行动画处理:
Animate 文档: http ://api.jquery.com/animate/
Sure! If you want to have the link fade out, you'll need jQuery UI to animate the color:
Animate docs: http://api.jquery.com/animate/