Tuesday, March 15, 2011

Blinking text using jquery

Hi,

The following code is to blink the text using jquery


<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.1.min.js"></script>

<div id="msg"> <strong><font color="red">Awesome Gallery By Anil Labs</font></strong></p> </div>

<script type="text/javascript" >
function blink(selector){
$(selector).fadeOut('slow', function(){
$(this).fadeIn('slow', function(){
blink(this);
});
});
}

blink('#msg');
</script>

23 comments:

  1. ThanQ Anil kumar

    ReplyDelete
  2. Works perfectly! Exactly the thing I wanted, only need to modify the effect. Thanx a lot!

    ReplyDelete
  3. Tis' cool but doesn't work in Safari :)

    ReplyDelete
  4. Should remove the extra backslash on the end of "<script text=..".

    ReplyDelete
  5. Thanks for acript
    Nice one

    ReplyDelete
  6. THANKS WORKING WELL

    ReplyDelete
  7. but its not working when we put the div in the body why???

    ReplyDelete
  8. Dear Anonymous, if you want to but the div at the body, then instead of blink('#msg'); , add the following code :

    jQuery(document).ready(function() {
    blink('#msg');
    });


    The thing is that you are trying to call div #msg at the head section and it does not exist yet as it is at the body tag, my code will call the div after the entire page load.

    Thanks Anil...

    ReplyDelete
  9. how to stop the function after certain time

    ReplyDelete
  10. setInterval(function() {
    jQuery('.blink').fadeOut('slow', function(){
    jQuery(this).fadeIn('slow');
    });
    }, 5000);

    ReplyDelete
  11. hii this is kriti and i am having a query...
    How to search a string for a specified value, and returns the text of the found value and to blink it?

    ReplyDelete
  12. How to blink a particular letter in the word using jquery ?
    For example :-

    Word is :- Awesome
    letter to blink is :- s

    Please suggest possible solutions .

    Thanks in advance.

    ReplyDelete
  13. kriti: i am also having the same query.

    ReplyDelete
  14. This works. Thanks Anil and keep up the good work!!

    ReplyDelete
  15. Recursive calling the method (blink) without return.is it correct?

    ReplyDelete
  16. Or simply:

    function blink(selector) {
    $(selector).fadeToggle('slow', function(){ blink(this); });
    }

    ReplyDelete
  17. hai am doing a project using html n jsp as a fresher i am not getting much idea plz help me frnd , n dis s my id aishukutty2@gmail.com plz within in today ..........))))))))))

    ReplyDelete
  18. Thanks i benefited so much from this post. How do i make it blink a bit more slower. Pls email me at cryswen@gmail.com. i am most grateful. Welldone friend.

    ReplyDelete