Reputation: 729
I'm having some trouble with this.
Basically I want to first check if a certain element has a particular class (In this case .active
) and, if it does, I want to use jQuery's fadeIn
on the .active
elements children.
This is what I'm using currently but it doesn't seem to work;
if ( $('.slides li').hasClass('active') ){
$('.slides li .content').delay(1000).fadeIn('slow');
}
Does anyone have any ideas?
Upvotes: 0
Views: 479
Reputation: 22711
Can you try this,
$('.slides li').each(function(){
if($(this).hasClass('active')){
$(this).delay(1000).fadeIn('slow');
}
});
Upvotes: 1
Reputation: 388316
You can use
$('.slides li.active .content').delay(1000).fadeIn('slow');
in your case any of the li
has the class active all .content element within the slides
are shown
Upvotes: 1