1.开关灯效果

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .hide{
            display: none;
        }
    </style>
</head>
<body>
    <input  />
    <div class="c1 hide">假装现在有效果了</div>

    <script src="jquery-1.12.4.js"></script>
    <script>
        $('#i1').click(function () {
            /* 第一种方法
            if($('.c1').hasClass('hide')){
                $('.c1').removeClass('hide')
            }else {
                $('.c1').addClass('hide')
            }   */
            //jquery实现方法
            $('.c1').toggleClass('hide')
        })
    </script>
</body>
</html>
View Code

相关文章:

  • 2022-12-23
  • 2021-12-05
  • 2021-12-05
  • 2021-12-05
  • 2021-05-10
  • 2021-08-21
  • 2021-06-26
  • 2022-01-05
猜你喜欢
  • 2021-12-05
  • 2021-12-25
  • 2021-06-01
相关资源
相似解决方案