<blink> tag in Internet Explorer

2019-02-07 02:17发布

问题:

Neither the <blink> tag nor the text-decoration:blink; style in css are supported in Internet Explorer.

Is there any technique available for making blinking text in IE?

回答1:

Avoid blinking, if possible - it annoys people.

But you can do it with JS/jQuery like this:

setInterval(jQuery('.blinking').toggle, 1500 );

That'll show/hide anything with the blinking class every 1.5 seconds.

So in the HTML you would do:

<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.



回答2:

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/


You can also use this code:

$(document).ready(function () {
    setInterval("$('.blink').fadeOut(150).fadeIn(150);",1000);
});

see working demo http://jsfiddle.net/SGrmM/1/


see booth examples in the same fiddle http://jsfiddle.net/SGrmM/2/