jquery "or" statement
How do i use an "or" statement in jquery, i have two separate statements that i think i can combine to be just one:
$('li.members').hover(function() {
$('.members-show').show();
$('.brokers-show').hide();
$('.providers-show').hide();
$('.employers-show').hide();
$('.seniors-show').hide();
return false;
});
$('li.members-active').hover(function() {开发者_StackOverflow社区
$('.members-show').show();
$('.brokers-show').hide();
$('.providers-show').hide();
$('.employers-show').hide();
$('.seniors-show').hide();
return false;
});
$('li.members, li.members-active').hover(function() {
$('.members-show').show();
$('.brokers-show').hide();
$('.providers-show').hide();
$('.employers-show').hide();
$('.seniors-show').hide();
return false;
});
$('li.members, li.members-active').hover(function() {
$('.members-show').show();
$('.members-show, .providers-show, .employers-show, .seniors-show').hide();
return false;
});
I think you can use Multiple Selector
Try the Multiple Selector:
$('li.members,li.members-active').hover(function() {
$('.members-show').show();
$('.brokers-show').hide();
$('.providers-show').hide();
$('.employers-show').hide();
$('.seniors-show').hide();
return false;
});
精彩评论