Blinking an item. (Jquery FadeIn FadeOut ?)

Posted by 0plus1 on Stack Overflow See other posts from Stack Overflow or by 0plus1
Published on 2010-03-15T10:19:51Z Indexed on 2010/03/15 10:29 UTC
Read the original article Hit count: 346

Filed under:
|
|
|

I have two divs that I want to make blink at the same time until the user hovers the mouse on one of them.

var shouldiblink = '1';

function mrBlinko(divid){
 while (shouldiblink =='1') {
 $("#"+divid).fadeIn(100).fadeOut(300);
}

$(document).ready(function(){
 mrBlinko("mydiv1");
 mrBlinko("mydiv2");
}

The I'll have an hover event that sets shouldiblink to '0'. Problem is that the loops starts as soon as the page is ready and the browser crashes.

I'm stuck with this solution and I can't think of an alternative right now.

Can you help me?

Thank you very much.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about fadeout