Html按钮效果很好,但css按钮没有

时间:2018-03-05 12:29:08

标签: javascript jquery html css button

我不是编码的专家,我在用户点击第二个弹出窗口上的css按钮后创建了一个弹出脚本,用于cpa重定向。 但是当用户点击css按钮时,没有任何反应。我添加了一个html按钮,它就像一个魅力。我试图找出根本原因,但没有运气。

run the code here on w3schools.com

$(function() {
  openUp('#overlay')
  $("#popup").on('click', function() {
    openUp('#overlay2')
    closeDown('#overlay')
  });

  function openUp(el) {
    $(el).fadeIn(500, function() {
      $(this).next().show();
    });
  }

  function closeDown(el) {
    $(el).fadeOut(500, function() {
      $(this).next().hide();
    });
  }
  $('a').each(function(index, element) {
    $(this).click(function(e) {
      e.preventDefault();
    });
  });
});
#DIV_1 {
  bottom: 0px;
  box-shadow: rgba(255, 255, 255, 0.298) 0px 0px 2px 0px inset, rgba(255, 255, 255, 0.298) 0px 1px 0px 0px inset;
  box-sizing: border-box;
  color: rgb(255, 255, 255);
  cursor: pointer;
  display: inline-block;
  height: 39px;
  left: 0px;
  letter-spacing: 2px;
  position: relative;
  right: 0px;
  text-align: center;
  text-decoration: none solid rgb(255, 255, 255);
  text-shadow: rgb(0, 79, 132) 0px 1px 0px;
  text-size-adjust: 100%;
  top: 0px;
  width: 135px;
  column-rule-color: rgb(255, 255, 255);
  perspective-origin: 53.2344px 19.5px;
  transform-origin: 53.2344px 19.5px;
  caret-color: rgb(255, 255, 255);
  background: rgb(0, 109, 183) linear-gradient(0deg, rgb(0, 109, 183), rgb(0, 139, 234)) repeat scroll 0% 0% / auto padding-box border-box;
  border-top: 1px solid rgb(0, 79, 132);
  border-right: 1px solid rgb(0, 79, 132);
  border-bottom: 2px solid rgb(0, 79, 132);
  border-left: 1px solid rgb(0, 79, 132);
  font: normal normal 700 normal 10px / 10px Lego, sans-serif;
  outline: rgb(255, 255, 255) none 0px;
  padding: 13px 14px;
}


/*#DIV_1*/

img {
  width: 100%;
  object-fit: scale-down;
  min-width: 100%;
  height: auto;
}

.form-style-5 {
  max-width: 500px;
  display: inline-block;
  padding: 8px 16px;
  background: #f4f7f8;
  margin: 8px auto;
  padding: 16px;
  border-radius: 8px;
  font-family: Georgia, "Times New Roman", Times, serif;
}

.form-style-5 fieldset {
  border: none;
}

.form-style-5 legend {
  font-size: 1.4em;
  margin-bottom: 8px;
}

.form-style-5 label {
  display: block;
  margin-bottom: 6px;
}

.form-style-5 input[type="text"],
.form-style-5 input[type="date"],
.form-style-5 input[type="datetime"],
.form-style-5 input[type="email"],
.form-style-5 input[type="number"],
.form-style-5 input[type="search"],
.form-style-5 input[type="time"],
.form-style-5 input[type="url"],
.form-style-5 textarea,
.form-style-5 select {
  font-family: Georgia, "Times New Roman", Times, serif;
  background: rgba(255, 255, 255, .1);
  border: none;
  border-radius: 4px;
  font-size: 16px;
  margin: 0;
  outline: 0;
  padding: 7px;
  width: 100%;
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  background-color: #e8eeef;
  color: #8a97a0;
  -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03) inset;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03) inset;
  margin-bottom: 30px;
}

.form-style-5 input[type="text"]:focus,
.form-style-5 input[type="date"]:focus,
.form-style-5 input[type="datetime"]:focus,
.form-style-5 input[type="email"]:focus,
.form-style-5 input[type="number"]:focus,
.form-style-5 input[type="search"]:focus,
.form-style-5 input[type="time"]:focus,
.form-style-5 input[type="url"]:focus,
.form-style-5 textarea:focus,
.form-style-5 select:focus {
  background: #d2d9dd;
}

.form-style-5 select {
  -webkit-appearance: menulist-button;
  height: 30px;
}

.form-style-5 input[type="submit"],
.form-style-5 input[type="button"] {
  position: relative;
  display: block;
  padding: 17px 37px 16px 37px;
  color: #000;
  margin: 0 auto;
  font-size: 18px;
  text-align: center;
  font-style: normal;
  width: 100%;
  border: 1px solid #ffcf00;
  border-width: 1px 1px 3px;
  margin-bottom: 10px;
  background: rgb(255, 207, 0) none repeat scroll 0% 0% / auto padding-box border-box;
  box-shadow: rgba(232, 105, 2, 0.5) 0px 0px 25px 0px inset;
}

.form-style-5 input[type="submit"]:hover,
.form-style-5 input[type="button"]:hover {
  background: #ffae00;
}

.button {
  display: inline-block;
  border-radius: 4px;
  background-color: #f4511e;
  border: none;
  color: #FFFFFF;
  text-align: center;
  font-size: 28px;
  padding: 20px;
  width: 100%;
  transition: all 0.5s;
  cursor: pointer;
  margin: 5px;
}

.button span {
  cursor: pointer;
  display: inline-block;
  position: relative;
  transition: 0.5s;
}

.button span:after {
  content: '\00bb';
  position: absolute;
  opacity: 0;
  top: 0;
  right: -20px;
  transition: 0.1s;
}

.button:hover span {
  padding-right: 25px;
}

.button:hover span:after {
  opacity: 1;
  right: 0;
}
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="https://www.verifycaptcha.com/contentlockers/load.php?id={removed my aff id}"></script>
<div id="overlay" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #000; opacity: 0.05; filter: alpha(opacity=60); z-index: 99990; display: none"></div>
<div id="popup" style="position:fixed; display:none; top:110px;  width:90%; height:auto; left: 0; right: 0; margin: 0 auto; background-color:#FFFFFF; z-index:99999; padding:5px; border:solid 2px #1d8cd0; border-radius:5px;">
  <img class="aligncenter wp-image-21 size-full" src="https://images1.sykesassets.co.uk/assets/_files/cached/property/1500x1125/2906/sc_131608230613_2906_12.jpg" alt="ALT TEXT" width="492" height=a uto; />
  <p <div id="DIV_1">
    PROCEED >>
  </p>
</div>
<div id="overlay2" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #000; opacity: 0.1; filter: alpha(opacity=60); z-index: 99990; display: none"></div>
<div id="popup2" style="position:fixed; display:none; top:110px;  width:85%; height:auto; left: 0; right: 0; margin: 0 auto; background-color:#FFFFFF; z-index:99999; padding:5px; border:solid 2px #1d8cd0; border-radius:5px;">
  <p style="color:#FFFFFF;">
  </p>
  <div class="form-style-5">
    <form>
      <fieldset>
        <legend><span class="number"></span> Please enter your information</legend>
        <input type="text" name="field1" placeholder="Receiver's full name *">
        <input type="email" name="field2" placeholder="Email *">
        <textarea name="field3" placeholder="Shipping address:"></textarea>
        <label for="job">Country:</label>
        <select id="job" name="field4">
                    <option value="USA">USA</option>
                    <option value="UK">UK</option>
                </select>
        <textarea name="field5" placeholder="Greeting message: Eg. Hi Jonathan, ..Loving sister, Christina."></textarea>
      </fieldset>
      <button type="button" id="myBtn" onclick="og_load();">Apply</button>
      <button class="button" style="vertical-align:middle" onclick="og_load();"><span>Apply </span></button>
    </form>
  </div>
</div>

<head>
  <script type="text/javascript" src="https://www.verifycaptcha.com/contentlockers/load.php?(removed my affiliate code)"></script>
</head>

1 个答案:

答案 0 :(得分:0)

不确定'css-button'是什么,但为什么不将.button类添加到按钮中,如下所示:

<button class="button" type="button" id="myBtn" onclick="og_load();">Apply</button>