There used to be CSS property called “text-decoration” and HTML tag “blink” that allowed you to do that easily, but modern browsers these days doesn’t support them anymore. so only option left is to use jQuery for that. Here in this tutorial I’m going to show you a very simple trick you can use to make text blink with JavaScript and CSS3.
I am using setInterval function and toggle function to blink text in this tutorial. As you can see, the “blink” class is added on the “P” element which contains the text that we wanted to blink, and between the interval of 500 milliseconds the “blink” class gets added and then removed.
By default we have set the “P” element to have CSS3 transition property which creates the fade in and fade out effect every time a property changes and the class “blink” has the css property of color set to be transparent meaning it makes the text invisible, so every time the “blink” class is added the text becomes invisible and then visible again when the “blink” class is removed.
This is a really simple way to do this and might be useful sometimes.
http://www.andwecode.com/blink-text-using-simple-javascript-css3/#tab-4820-demo
No hay comentarios:
Publicar un comentario