1 Replies - 1970 Views - Last Post: 02 November 2012 - 02:37 AM

#1 sabinmash  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 11-October 12

Why does this animate callback function loop 33 times?

Posted 11 October 2012 - 10:55 PM

This callback has a counter, and i can see that the counter goes to 33, and quite slowly at that. Takes about 11 seconds to loop 33 times, and the other animations won't go until it stops.

Any idea as to why this is happening?

var counter1= 0;
$("#StartUpPosition div").not("#StartUpMainNode").fadeOut(300, function() {  
      $("#StartUpMainNode").animate( {left:22}, function() {   //animate the center node to the left
       counter1++;
 $("#NodeMain").fadeIn(200); 
 console.log(counter1);
 });
});


Is This A Good Question/Topic? 0
  • +

Replies To: Why does this animate callback function loop 33 times?

#2 Kruithne  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 99
  • View blog
  • Posts: 442
  • Joined: 28-July 09

Re: Why does this animate callback function loop 33 times?

Posted 02 November 2012 - 02:37 AM

Hello sabinmash,

What is the starting left position of the DIV you are moving? You are moving it to position 22 so it sounds like it starts 33 away from that (at 55) which is what causes the loop to trigger that many times.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1