Warning: Cannot modify header information - headers already sent by (output started at /home/cssquirrel/www.cssquirrel.com/blog/index.php:4) in /home/cssquirrel/www.cssquirrel.com/blog/wp-includes/feed-rss2-comments.php on line 8
Comments on: Javascript Looping Object Instance’s Method Problem http://cssquirrel.com/blog/2009/06/03/javascript-looping-object-instances-method-problem/ opinions and news on web design Mon, 12 Dec 2011 18:22:38 +0000 hourly 1 http://wordpress.org/?v=3.3.1 By: zedzdead http://cssquirrel.com/blog/2009/06/03/javascript-looping-object-instances-method-problem/comment-page-1/#comment-25279 zedzdead Mon, 08 Jun 2009 11:01:59 +0000 http://www.cssquirrel.com/?p=303#comment-25279 You could always follow http://twitter.com/ioubeer (http://foamee.com/)and @danieltott. Rather freakily somebody has @ioubeer'd dan lately! You could always follow http://twitter.com/ioubeer (http://foamee.com/)and @danieltott.

Rather freakily somebody has @ioubeer’d dan lately!

]]>
By: Dan Ott http://cssquirrel.com/blog/2009/06/03/javascript-looping-object-instances-method-problem/comment-page-1/#comment-25171 Dan Ott Wed, 03 Jun 2009 18:17:04 +0000 http://www.cssquirrel.com/?p=303#comment-25171 @Kyle No cake? What a ripoff(: Glad to help. @Kyle No cake? What a ripoff(:

Glad to help.

]]>
By: Kyle Weems http://cssquirrel.com/blog/2009/06/03/javascript-looping-object-instances-method-problem/comment-page-1/#comment-25170 Kyle Weems Wed, 03 Jun 2009 18:15:16 +0000 http://www.cssquirrel.com/?p=303#comment-25170 @Dan - I thought it was a scope issue, but I just couldn't figure out how to sidestep that. Thanks! That seems to have nailed the issue I was having. You, sir, are awesome and deserve a piece of cake. I, sadly, don't have any cake to give you. @Dan – I thought it was a scope issue, but I just couldn’t figure out how to sidestep that.

Thanks! That seems to have nailed the issue I was having.

You, sir, are awesome and deserve a piece of cake.

I, sadly, don’t have any cake to give you.

]]>
By: Dan Ott http://cssquirrel.com/blog/2009/06/03/javascript-looping-object-instances-method-problem/comment-page-1/#comment-25169 Dan Ott Wed, 03 Jun 2009 17:53:33 +0000 http://www.cssquirrel.com/?p=303#comment-25169 This scope of the callback function changes, so when you say "this.greet" inside the callback function, it thinks "this" is the callback function, not the original object. One really easy way to get around that: <code> var myObj = this; if(this.count < 2) { $('body').animate({"opacity":1}, 1000, function(){myObj.greet();}); } </code> That should take care of it. This scope of the callback function changes, so when you say “this.greet” inside the callback function, it thinks “this” is the callback function, not the original object.

One really easy way to get around that:

var myObj = this;
if(this.count < 2) {
$('body').animate({"opacity":1}, 1000, function(){myObj.greet();});
}

That should take care of it.

]]>