0

html

<div id="one" class="bubble"></div>   
<div id="two" class="bubble"></div>  
<div id="three" class="bubble"></div> 

Jquery

 $(function () {

              function bubble ()
              {
                 $(this).fadeIn(300).delay(2000).fadeOut(400);
              }
            }); 
            $( document ).ready(function() {
               $(.bubble).bubble();
            }); 

I'm not really good with jquery, now what i'm trying to do is to fadein and fadeout the elements with class bubble, what's going wrong?

1
  • 1
    $(".bubble").each(bubble); might work Commented May 11, 2014 at 20:47

1 Answer 1

2

Try passing it as a parameter:

function bubble (el)
{
    el.fadeIn(300).delay(2000).fadeOut(400);
}
bubble($('.bubble'));
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.