【问题标题】:Is there something missing in order to hide with if statement是否缺少某些东西以便用 if 语句隐藏
【发布时间】:2021-10-15 04:37:40
【问题描述】:

我得到了 3 张卡片,“卡片”课程,还给了他们“1卡片,2卡片,3卡片”课程。当我尝试输入此代码时不起作用,为什么?我希望在单击第二张和第三张卡片后隐藏第一张卡片

    $(".cards").on("click", function(){
if ($(".1card")){
    $(".2card, .3card").slideUp(1000);
} else {
    $(".1card").slideUp(1000)
}
})

【问题讨论】:

    标签: jquery effects


    【解决方案1】:

    在点击事件上触发其他两个元素来隐藏第一个

    $('.2card, .3card').on('click', function (){
      $('.1card').hide();
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-15
      • 2012-09-26
      • 2019-01-05
      • 2015-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多