带有复选框弹出窗口的JavaScript淡入不起作用

时间:2019-04-23 21:27:33

标签: javascript jquery html

我正在制作一个弹出复选框,但是当我尝试显示它时,即使常规警报正在工作,它也没有显示任何内容。.我在使登录弹出窗口idk为何不在这里工作时已经使用了fading多次。 / p>

<form>
        <div class="Style-popup">
            <div class="InnerStyle-popup">
                    <label class="container">One
                      <input type="checkbox" checked="checked">
                      <span class="checkmark"></span>
                    </label>

                    <label class="container">Two
                      <input type="checkbox">
                      <span class="checkmark"></span>
                    </label>

                    <label class="container">Three
                      <input type="checkbox">
                      <span class="checkmark"></span>
                    </label>

                    <label class="container">Four
                      <input type="checkbox">
                      <span class="checkmark"></span>
                    </label>
              </div>
            </div>

    </form>

$('.define-style').click(function(){

    $('.Style-popup').fadeIn();
    //alert('dss');

});

2 个答案:

答案 0 :(得分:0)

// Code goes here

$(document).ready(function(){
 $('.define-style').click(function(){ 
    $('form').fadeIn();    
});
});
/* Styles go here */

form{
  display:none;
}
<!DOCTYPE html>
<html>

  <head>
    <script data-require="jquery@3.2.1" data-semver="3.2.1" src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js"></script>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>

  <body>
    <form>
      <div class="Style-popup">
        <div class="InnerStyle-popup">
          <label class="container">One
                                  <input type="checkbox" checked="checked" />
            <span class="checkmark"></span>
          </label>
          <label class="container">Two
                                  <input type="checkbox" />
            <span class="checkmark"></span>
          </label>
          <label class="container">Three
                                  <input type="checkbox" />
            <span class="checkmark"></span>
          </label>
          <label class="container">Four
                                  <input type="checkbox" />
            <span class="checkmark"></span>
          </label>
        </div>
      </div>
    </form>
    <button class="define-style">Fade</button>
  </body>

</html>

如果您要设置不显示任何内容,请尝试淡入为:

$(document).ready(function(){
 $('.define-style').click(function(){ 
    $('form').fadeIn();    
});
});

答案 1 :(得分:0)

必须查看更多代码。我填补了空白,fadeIn对我有用

<body>
  <form class="define-style">
    <div class="Style-popup">
      <div class="InnerStyle-popup">
        <label class="container">One
          <input type="checkbox" checked="checked">
          <span class="checkmark"></span>
        </label>

        <label class="container">Two
          <input type="checkbox">
          <span class="checkmark"></span>
        </label>

        <label class="container">Three
          <input type="checkbox">
          <span class="checkmark"></span>
        </label>

        <label class="container">Four
          <input type="checkbox">
          <span class="checkmark"></span>
        </label>
      </div>
    </div>

  </form>

CSS

.define-style {
  height: 500px;
  width: 500px;
  background-color: aquamarine;
}

.Style-popup {
  display: none;
}

jQuery

'use strict';

$('.define-style').click(function(){

  $('.Style-popup').fadeIn(2000);
  // alert('dss');
});