<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: JQuery: Waiting for Multiple Animations to Complete</title>
	<atom:link href="http://www.gmarwaha.com/blog/2009/06/09/jquery-waiting-for-multiple-animations-to-complete/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gmarwaha.com/blog/2009/06/09/jquery-waiting-for-multiple-animations-to-complete/</link>
	<description>Ganesh\</description>
	<lastBuildDate>Sat, 31 Jul 2010 07:07:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Saulo Padilha</title>
		<link>http://www.gmarwaha.com/blog/2009/06/09/jquery-waiting-for-multiple-animations-to-complete/comment-page-1/#comment-75220</link>
		<dc:creator>Saulo Padilha</dc:creator>
		<pubDate>Mon, 05 Jul 2010 09:35:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.gmarwaha.com/blog/?p=31#comment-75220</guid>
		<description>Great! That worked perfect and don&#039;t need a big block of code. 

Thanks, man!</description>
		<content:encoded><![CDATA[<p>Great! That worked perfect and don&#8217;t need a big block of code. </p>
<p>Thanks, man!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wusthof Cutlery</title>
		<link>http://www.gmarwaha.com/blog/2009/06/09/jquery-waiting-for-multiple-animations-to-complete/comment-page-1/#comment-75102</link>
		<dc:creator>Wusthof Cutlery</dc:creator>
		<pubDate>Fri, 02 Jul 2010 17:19:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.gmarwaha.com/blog/?p=31#comment-75102</guid>
		<description>Just thought i&#039;d comment and say neat design, did you code it yourself? Looksvery good.</description>
		<content:encoded><![CDATA[<p>Just thought i&#8217;d comment and say neat design, did you code it yourself? Looksvery good.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ugg boots outlet</title>
		<link>http://www.gmarwaha.com/blog/2009/06/09/jquery-waiting-for-multiple-animations-to-complete/comment-page-1/#comment-74305</link>
		<dc:creator>ugg boots outlet</dc:creator>
		<pubDate>Thu, 17 Jun 2010 07:49:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.gmarwaha.com/blog/?p=31#comment-74305</guid>
		<description>the thing you you like ,the thing you will do .</description>
		<content:encoded><![CDATA[<p>the thing you you like ,the thing you will do .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: travesti</title>
		<link>http://www.gmarwaha.com/blog/2009/06/09/jquery-waiting-for-multiple-animations-to-complete/comment-page-1/#comment-73440</link>
		<dc:creator>travesti</dc:creator>
		<pubDate>Wed, 02 Jun 2010 16:55:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.gmarwaha.com/blog/?p=31#comment-73440</guid>
		<description>$(“#elm2?).slideDown(4000,cb1); what ?</description>
		<content:encoded><![CDATA[<p>$(“#elm2?).slideDown(4000,cb1); what ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: An Ngo</title>
		<link>http://www.gmarwaha.com/blog/2009/06/09/jquery-waiting-for-multiple-animations-to-complete/comment-page-1/#comment-73297</link>
		<dc:creator>An Ngo</dc:creator>
		<pubDate>Mon, 31 May 2010 06:43:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.gmarwaha.com/blog/?p=31#comment-73297</guid>
		<description>Here is a simple plugin to handle this problem using closure

$.waitForNAnimations = function(numberOfAnimations,callback) {
  var count = 0; 
  function cb() {
    count++;
    if ( count == numberOfAnimations) {
      count = 0;
      callback();
    }
  }
  return cb; 
}

Usage: For each group of animations, define one callback function 

cb = $.waitForNAnimations(numberOfElements, function () {
	... call back code 
});

Then
$(&quot;#element1&quot;).slideDown(1000,cb);
$(&quot;#element2&quot;).slideDown(2000,cb);

Example 


Waiting for multiple animations
&lt;script src=&quot;/js/jquery-1.3.1.js&quot; language=&quot;JavaScript&quot; 


$.waitForNAnimations = function(numberOfAnimations,callback) {
  var count = 0; 
  function cb() {
    count++;
    if ( count == numberOfAnimations) {
      count = 0;
      callback();
    }
  }
  return cb; 
}

cb1 = $.waitForNAnimations(2, function () {
  alert(&quot;Group 1 Done&quot;);
});

function animate1() {
  if ($(&quot;#elm1&quot;).is(&quot;:hidden&quot;)) {
    $(&quot;#elm1&quot;).slideDown(2000,cb1);
    $(&quot;#elm2&quot;).slideDown(4000,cb1);  
  } else {
    $(&quot;#elm1&quot;).hide();
    $(&quot;#elm2&quot;).hide();
  }	
}

cb2 = $.waitForNAnimations(3, function () {
  alert(&quot;Group 2 Done&quot;);
});

function animate2() {
  if ($(&quot;#elm3&quot;).is(&quot;:hidden&quot;)) {
    $(&quot;#elm3&quot;).slideDown(2000,cb2);
    $(&quot;#elm4&quot;).slideDown(4000,cb2);
    $(&quot;#elm5&quot;).slideDown(6000,cb2);		
  } else {
    $(&quot;#elm3&quot;).hide();
    $(&quot;#elm4&quot;).hide();
    $(&quot;#elm5&quot;).hide();
  }	
}




div { background:#de9a44; margin:3px; width:80px; 
height:40px; display:none; float:left; }






 









</description>
		<content:encoded><![CDATA[<p>Here is a simple plugin to handle this problem using closure</p>
<p>$.waitForNAnimations = function(numberOfAnimations,callback) {<br />
  var count = 0;<br />
  function cb() {<br />
    count++;<br />
    if ( count == numberOfAnimations) {<br />
      count = 0;<br />
      callback();<br />
    }<br />
  }<br />
  return cb;<br />
}</p>
<p>Usage: For each group of animations, define one callback function </p>
<p>cb = $.waitForNAnimations(numberOfElements, function () {<br />
	&#8230; call back code<br />
});</p>
<p>Then<br />
$(&#8220;#element1&#8243;).slideDown(1000,cb);<br />
$(&#8220;#element2&#8243;).slideDown(2000,cb);</p>
<p>Example </p>
<p>Waiting for multiple animations<br />
&lt;script src=&quot;/js/jquery-1.3.1.js&quot; language=&quot;JavaScript&quot; </p>
<p>$.waitForNAnimations = function(numberOfAnimations,callback) {<br />
  var count = 0;<br />
  function cb() {<br />
    count++;<br />
    if ( count == numberOfAnimations) {<br />
      count = 0;<br />
      callback();<br />
    }<br />
  }<br />
  return cb;<br />
}</p>
<p>cb1 = $.waitForNAnimations(2, function () {<br />
  alert(&#8220;Group 1 Done&#8221;);<br />
});</p>
<p>function animate1() {<br />
  if ($(&#8220;#elm1&#8243;).is(&#8220;:hidden&#8221;)) {<br />
    $(&#8220;#elm1&#8243;).slideDown(2000,cb1);<br />
    $(&#8220;#elm2&#8243;).slideDown(4000,cb1);<br />
  } else {<br />
    $(&#8220;#elm1&#8243;).hide();<br />
    $(&#8220;#elm2&#8243;).hide();<br />
  }<br />
}</p>
<p>cb2 = $.waitForNAnimations(3, function () {<br />
  alert(&#8220;Group 2 Done&#8221;);<br />
});</p>
<p>function animate2() {<br />
  if ($(&#8220;#elm3&#8243;).is(&#8220;:hidden&#8221;)) {<br />
    $(&#8220;#elm3&#8243;).slideDown(2000,cb2);<br />
    $(&#8220;#elm4&#8243;).slideDown(4000,cb2);<br />
    $(&#8220;#elm5&#8243;).slideDown(6000,cb2);<br />
  } else {<br />
    $(&#8220;#elm3&#8243;).hide();<br />
    $(&#8220;#elm4&#8243;).hide();<br />
    $(&#8220;#elm5&#8243;).hide();<br />
  }<br />
}</p>
<p>div { background:#de9a44; margin:3px; width:80px;<br />
height:40px; display:none; float:left; }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: travesti</title>
		<link>http://www.gmarwaha.com/blog/2009/06/09/jquery-waiting-for-multiple-animations-to-complete/comment-page-1/#comment-71117</link>
		<dc:creator>travesti</dc:creator>
		<pubDate>Sun, 25 Apr 2010 10:20:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.gmarwaha.com/blog/?p=31#comment-71117</guid>
		<description>If the condition is met, it means that the animations are complete.</description>
		<content:encoded><![CDATA[<p>If the condition is met, it means that the animations are complete.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: example animations</title>
		<link>http://www.gmarwaha.com/blog/2009/06/09/jquery-waiting-for-multiple-animations-to-complete/comment-page-1/#comment-70314</link>
		<dc:creator>example animations</dc:creator>
		<pubDate>Sun, 04 Apr 2010 08:54:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.gmarwaha.com/blog/?p=31#comment-70314</guid>
		<description>[...] Previous Post. Leave a Reply. Name (required) Mail (will not be published) (required) Website ...JQuery: Waiting for Multiple Animations to Complete &#124; GaneshHave you ever come across a situation where you wanted to execute a certain piece of code after an [...]</description>
		<content:encoded><![CDATA[<p>[...] Previous Post. Leave a Reply. Name (required) Mail (will not be published) (required) Website &#8230;JQuery: Waiting for Multiple Animations to Complete | GaneshHave you ever come across a situation where you wanted to execute a certain piece of code after an [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prizmacelikkapi</title>
		<link>http://www.gmarwaha.com/blog/2009/06/09/jquery-waiting-for-multiple-animations-to-complete/comment-page-1/#comment-69933</link>
		<dc:creator>prizmacelikkapi</dc:creator>
		<pubDate>Thu, 25 Mar 2010 11:25:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.gmarwaha.com/blog/?p=31#comment-69933</guid>
		<description>better and more efficient approach to solve the same challenge. If fellow jquery lovers are aware of such solutions please feel free to leave a comment.</description>
		<content:encoded><![CDATA[<p>better and more efficient approach to solve the same challenge. If fellow jquery lovers are aware of such solutions please feel free to leave a comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: m3 ds real</title>
		<link>http://www.gmarwaha.com/blog/2009/06/09/jquery-waiting-for-multiple-animations-to-complete/comment-page-1/#comment-68529</link>
		<dc:creator>m3 ds real</dc:creator>
		<pubDate>Fri, 19 Feb 2010 12:30:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.gmarwaha.com/blog/?p=31#comment-68529</guid>
		<description>AJAX and PHP is a great resource for PHP developers who want to expand their knowledge into front end web languages.But here I got some practical stuff!see...nobody so kind like you dude!Thanks for all information!</description>
		<content:encoded><![CDATA[<p>AJAX and PHP is a great resource for PHP developers who want to expand their knowledge into front end web languages.But here I got some practical stuff!see&#8230;nobody so kind like you dude!Thanks for all information!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: çelik kap?</title>
		<link>http://www.gmarwaha.com/blog/2009/06/09/jquery-waiting-for-multiple-animations-to-complete/comment-page-1/#comment-65589</link>
		<dc:creator>çelik kap?</dc:creator>
		<pubDate>Sun, 06 Dec 2009 11:01:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.gmarwaha.com/blog/?p=31#comment-65589</guid>
		<description>Ofcourse, the same code can be modified for more than two elements as well. Some more work, and we can make it handle any number of elements. But, I was wondering if there was an easier, better and more efficient approach to solve the same challenge. If fellow jquery lovers are aware of such solutions please feel free to leave a comment.</description>
		<content:encoded><![CDATA[<p>Ofcourse, the same code can be modified for more than two elements as well. Some more work, and we can make it handle any number of elements. But, I was wondering if there was an easier, better and more efficient approach to solve the same challenge. If fellow jquery lovers are aware of such solutions please feel free to leave a comment.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
