Text Blinking with jQuery
Blinking text can be easily achieved using jQuery. Here's a code snippet that makes any text element with the class "blink" blink indefinitely:
<code class="javascript">$('.blink').each(function() { var elem = $(this); setInterval(function() { if (elem.css('visibility') == 'hidden') { elem.css('visibility', 'visible'); } else { elem.css('visibility', 'hidden'); } }, 500); });</code>
To stop the blinking, simply clear the interval associated with the text element:
<code class="javascript">$('.blink').each(function() { var elem = $(this); clearInterval(elem.data('blinkInterval')); });</code>
The above is the detailed content of How to Make Text Blink Using jQuery?. For more information, please follow other related articles on the PHP Chinese website!