开发者

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;
  });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜