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