CSS Cart弹出框不会与多个产品关闭

时间:2015-04-03 16:14:54

标签: css popup cart

我正在尝试创建一个纯css弹出框,当您访问我的网站上的购物车时会自动弹出,告诉您特殊优惠,并且工作正常,直到您有多个项目购物车,然后由于某种原因看起来它正在创建多个弹出框,他们不会关闭。

我想知道是否有人可以帮我弄清楚如何让弹出窗口关闭?或者可能是另一个解决方案?

谢谢,

a.popup-link {
  padding:17px 0;
  text-align: center;
  margin:10% auto;
  position: relative;
  width: 300px;
  color: #fff;
  text-decoration: none;
  background-color: #f87300;
  border-radius: 3px;
  box-shadow: 0 5px 0px 0px #eea900;
  display: block;
}

a.popup-link:hover {
  background-color: #ff9900;
  box-shadow: 0 3px 0px 0px #eea900;
  -webkit-transition:all 1s;
  transition:all 1s;
}

@-webkit-keyframes autopopup {
  from {opacity: 0;margin-top:-200px;}
  to {opacity: 1;}
}

@-moz-keyframes autopopup {
  from {opacity: 0;margin-top:-200px;}
  to {opacity: 1;}
}

@keyframes autopopup {
  from {opacity: 0;margin-top:-200px;}
  to {opacity: 1;}
}

#popup {
  position: fixed;
  top:0;
  left:0;
  right:0;
  bottom:0;
  margin:0;
  -webkit-animation:autopopup 2s;
  -moz-animation:autopopup 2s;
  animation:autopopup 2s;
  z-index:9999;
}

#popup:target {
  -webkit-transition:all 1s;
  -moz-transition:all 1s;
  transition:all 1s;
  opacity: 0;
  visibility: hidden;
}

@media (min-width: 768px){
  .popup-container {
    width:600px;
  }
}

@media (max-width: 767px){
  .popup-container {
    width:100%;
  }
}

.popup-container {
  position: relative;
  margin:7% auto;
  padding:30px 50px;
  background-color: #fafafa;
  color:#333;
  border-radius: 3px;
  z-index:9999;
}

a.popup-close {
  position: absolute;
  top:3px;
  right:3px;
  background-color: #f87300;
  padding:7px 10px;
  font-size: 20px;
  text-decoration: none;
  line-height: 1;
  color:#fff;
  border-radius: 3px;
}
    <div class="popup-wrapper" id="popup">
      <div class="popup-container">
        <h2>Spend $30...</h2>
        <p>Spend $30 or more and get this free flag!</p>
        <a class="popup-close" href="#popup">X</a>
      </div>
    </div>

0 个答案:

没有答案