CSS3 动画.css不适用于自定义模态

css3 animation.css not working with custom modal

本文关键字:自定义 模态 适用于 不适用 动画 css CSS3      更新时间:2023-09-26

我试图创建自己的整页模式,我取得了成功,但现在我想为它添加一个动画......正在使用 Animate.css 来完成此任务,但动画仅在添加放大或缩小动画类时才起作用

这是我尝试过的JSFiddel...任何帮助不胜感激...

我的网页

<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 效果的模态

当您将 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>

让我知道这是否适合您。