Sanyi, "this" is not the same when you're inside a nested function.
 
Add this line of code at the beginning of showFlash:
 
   var self = this;
 
And then change "this" to "self", and you'll be in business. (You can use any variable name instead of "self"; that's just a common choice.)
 
Also, since you're using $('#'+self.actualTab) and $('#comment-flash') more than once each, it's not a bad idea to save a reference to each, e.g.
 
   var $tab = $('#'+self.actualTab);
 
And then use $tab in place of the full $() call each time. Ditto for the comment-flash. In this particular piece of code, it may not make much difference, but it's a really good habit to get into for those cases where it does speed up performance.
 
-Mike


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sanyi
Sent: Thursday, October 12, 2006 1:23 AM
To: [email protected]
Subject: [jQuery] Set height problem

Hi All,

I have strange problem in this function I wrote:


1: function showFlash(text) {
2:    this.addFlash(text);
3:  
4:    $('#'+this.actualTab).height('265px');
5:  
6:    if (this.Flash != '') $('#comment-flash').animate(
7:        {opacity: 'show'},
8:        1500,
9:        function() {
10:            $('#'+this.actualTab).height('290px');
11:           $('#comment-flash').hide();
12:        }
13:    );
14:}

on line 4 the height has been given and can be shown, but on line 10 setting the height doesn't seemed to work. Is there anything I missed? I am newby to jQuery.

you can test it under following URL: http://mkmcom.hu/test2/index.html

Thx
Alex
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to