Indeed!!! Nice style
Will adopt it
thanks
Feijó
----- Original Message -----
From: "Andy Matthews" <[EMAIL PROTECTED]>
To: <jquery-en@googlegroups.com>
Sent: Monday, November 19, 2007 4:42 PM
Subject: [jQuery] Re: (this) question
Using the $ in a js variable (in the jQuery world) is generally a sign that
the variable contains a jQuery object. It's just a nice way of helping the
programmer know what to expect.
-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Feijó
Sent: Monday, November 19, 2007 12:40 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: (this) question
why do you use $ in JS variables? get used to after long years in php? :)
Feijó
----- Original Message -----
From: "Michael Geary" <[EMAIL PROTECTED]>
To: <jquery-en@googlegroups.com>
Sent: Monday, November 19, 2007 3:14 PM
Subject: [jQuery] Re: (this) question
Every function call has its own "this" - that's just the way JavaScript
works.
To fix it, assign "this" - or better yet in your case, "$(this)" - into a
variable outside the click function. We can also avoid the repeated calls
to
the same selector by using another variable:
$('.wallpaper').each(function(){
var $wallpaper = $(this);
var $anim = $wallpaper.find('.images > .anim').hide();
$wallpaper.find('.buttons > .anim').click(function(event){
$('p').toggleClass( 'rainbows' );
$wallpaper.find('p').toggleClass('fraggle');
// $anim.show();
// $wallpaper.find('.images > .static').hide();
return false;
})
});
-Mike