【问题标题】:Text blink from one color to another css or jquery [duplicate]文本从一种颜色闪烁到另一种 css 或 jquery [重复]
【发布时间】:2014-04-24 18:40:00
【问题描述】:

我想用两种不同的颜色闪烁文本:

例如:闪烁的文字白-绿-白-绿-白-绿

我不介意 jQuery 还是 CSS。

【问题讨论】:

标签: jquery css blink


【解决方案1】:

与我更好的判断相反,哈哈...您需要调整与 webkit 等的跨浏览器兼容性

经过编辑,可与所有浏览器一起使用

 <a href="#"> text</a>


 /* css */

 a {
   animation-duration: 400ms;
   animation-name: blink;
   animation-iteration-count: infinite;
   animation-direction: alternate;
}
@keyframes blink {
   from {
      opacity: 1;
   }
   to {
      opacity: 0;
   }
 }

DEMO

【讨论】:

  • 仅供参考,如果不添加供应商前缀 -webkit-,它在我最新版本的 chrome 中不起作用。您可能应该在某处提到这一点。
  • 是的,在 chrome 中它不起作用。
  • @onbermejo 现在可以了。也许您现在可以结束这个问题作为答案?
  • 我知道这很可怕,但已经不可能改变了……再次感谢您。 ;)
  • 这是“blink-fadeout”或“flashing”但不是“blink”
【解决方案2】:

http://jsfiddle.net/8Xhzt/12/

不支持 IE 9:animation-iteration-count
注意要支持当前不支持的浏览器,您可以使用 Modernizr: 见How do I normalize CSS3 Transition functions across browsers? CSS3 animation-fill-mode polyfill

@-webkit-keyframes blink {
   from { color: green; }
   to { color: white; }
  }
 @-moz-keyframes blink {
   from { color: green; }
   to { color: white; }
 }
 @-ms-keyframes blink {
   from { color: green; }
   to { color: white; }
 }
 @-o-keyframes blink {
   from { color: green; }
   to { color: white; }
 }
 @keyframes blink {
   from { color: green; }
   to { color: white; }
 }

 .blink {
    color: green;
    -webkit-animation: blink 2s 3 alternate;
    -moz-animation: blink 2s 3 alternate;  
    -ms-animation: blink 2s 3 alternate;  
    -o-animation: blink 2s 3 alternate;  
    animation: blink 2s 3 alternate;   
 }

【讨论】:

  • 您好!谢谢。你知道我怎么能做到无限吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-11-18
  • 1970-01-01
  • 2013-03-26
  • 1970-01-01
  • 2019-01-29
相关资源
最近更新 更多