Html Internet Explorer 中的 <blink> 标签
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2928103/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
<blink> tag in Internet Explorer
提问by Piyush
Neither the <blink>
tag nor the text-decoration:blink;
style in css are supported in Internet Explorer.
Internet Explorer 不支持 css 中的<blink>
标记和text-decoration:blink;
样式。
Is there any technique available for making blinking text in IE?
是否有任何技术可用于在 IE 中制作闪烁文本?
回答by Peter Boughton
Avoid blinking, if possible - it annoys people.
如果可能,请避免眨眼 - 它会惹恼人们。
But you can do it with JS/jQuery like this:
但是你可以像这样使用 JS/jQuery 来做到这一点:
setInterval(jQuery('.blinking').toggle, 1500 );
That'll show/hide anything with the blinking class every 1.5 seconds.
这将每 1.5 秒显示/隐藏闪烁类的任何内容。
So in the HTML you would do:
所以在 HTML 中你会这样做:
<span class="blinking">hello!</span>
But again, think very carefully about whether it should be blinking!
但是,再次仔细考虑它是否应该闪烁!
If you need something to specifically draw a user's attention (and for whatever reason regular emphasis/highlighting/etc isn't good enough), then instead of on-off blinking (where the text dissappears for half the time), consider changing the colour, or a blinking underline/border, or similar.
如果您需要一些东西来特别吸引用户的注意力(无论出于何种原因,常规强调/突出显示/等都不够好),那么不要开关闪烁(文本有一半时间消失),请考虑更改颜色,或闪烁的下划线/边框,或类似的。
The key thing is, if something is important enough to visually annoy the user then it should remain readable.
关键是,如果某件事很重要,足以在视觉上惹恼用户,那么它应该保持可读性。
回答by bernte
You can use this code:
您可以使用此代码:
$(document).ready(function () {
setInterval("$('.blink').fadeOut().fadeIn();",1500);
});
and a class link this
和一个班级链接这个
<div class="blink">BLING BLING...</div>
see working demo http://jsfiddle.net/SGrmM/
见工作演示http://jsfiddle.net/SGrmM/
You can also use this code:
您也可以使用此代码:
$(document).ready(function () {
setInterval("$('.blink').fadeOut(150).fadeIn(150);",1000);
});
see working demo http://jsfiddle.net/SGrmM/1/
见工作演示http://jsfiddle.net/SGrmM/1/
see booth examples in the same fiddle http://jsfiddle.net/SGrmM/2/
请参阅同一小提琴http://jsfiddle.net/SGrmM/2/中的展位示例