簡體   English   中英

CSS3 animation.css無法使用自定義模式

[英]css3 animation.css not working with custom modal

我嘗試創建自己的全頁模式,但在此過程中我獲得了成功,但是現在我想向其中添加動畫...正在使用animate.css來完成此任務,但是僅當添加zoomIn或zoomOut動畫類

這是我嘗試過的JSFiddel

我的HTML

<div class="am-modal" id="examples-modal">
  <a href="javascript:void(0);" class="am-colse"> Back</a>
  <div class="head">
    Trying Modal with zoonIn and out effect
  </div>

</div>
<a href="javascript:void(0)" class="am-modal-trigger" data-am-target="#examples-modal">Modal Trigger</a>

的CSS

.am-modal {
  display: none;
  width: 100%;
  position: absolute;
  top: 0px;
  left: 0px;
  background-color: #2c3e50;
  padding : 20px;
}
.am-modal a{
  float : float;
}
.head{  
  margin-top : 40px;
  font-size : 25px;
  color : #fff;
  text-align : center;
}

jQuery的

$(document).ready(function(e) {

  resizeDiv();
  window.onresize = function(event) {
    resizeDiv();
  }

  function resizeDiv() {
    vpw = $(window).width();
    vph = $(window).height();
    $('.am-modal').css('height', vph + "px");
  }

  $('.am-modal-trigger').on('click', function() {
    var target = $(this).data('am-target');
    $(target).css('display','block');
    $(target).addClass('zoomIn');
  });

  $('.am-colse').on('click', function() {
    $(this).parent().removeClass('zoomIn').addClass('zoomOut');
    $(this).parent().css('display','none');
  });


});

jsfiddle您需要添加“動畫”類

<div class="am-modal animated" id="examples-modal">

使用ZoonIn和Out效果嘗試Modal

將zoomIn類添加到模態中時,是否確定要添加animated類? 這適用於您提供的JSFiddel:

<div class="am-modal animated zoomIn" id="examples-modal">
  <a href="javascript:void(0);" class="am-colse"> Back</a>
  <div class="head">
    Trying Modal with zoonIn and out effect
  </div>
</div>

讓我知道這是否適合您。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM