Twitter bootstrap 在引导4中从底部向上滑动的模式

Twitter bootstrap 在引导4中从底部向上滑动的模式,twitter-bootstrap,css,bootstrap-4,css-transforms,Twitter Bootstrap,Css,Bootstrap 4,Css Transforms,我正在尝试设置一个从底部向上滑动的模式,但是对于Bootstrap4,还没有一个真正有效的教程。以下是一个尝试: HTML 我将W3CSS框架与模态动画结合使用,它看起来是这样的,希望能有所帮助: HTML: <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <button type="submit" class="btn btn-block btn-default footer__

我正在尝试设置一个从底部向上滑动的模式,但是对于Bootstrap4,还没有一个真正有效的教程。以下是一个尝试:

HTML


我将W3CSS框架与模态动画结合使用,它看起来是这样的,希望能有所帮助:

HTML:

<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<button type="submit" class="btn btn-block btn-default footer__btn" data-toggle="modal" data-target="#myModal2"> Open Modal</button>
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content w3-animate-bottom">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel"> ABOUT </h4>
      </div>
      <div class="modal-body">
        CONTEÚDO
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

      </div>
    </div>
  </div>
</div>

由于您不想在Bootstrap 4上添加另一个框架,我只是更改了CSS:

.animate-bottom {
  position: relative;
  animation: animatebottom 0.4s;
}

@keyframes animatebottom {
  from {
    bottom: -300px;
    opacity: 0;
  }

  to {
    bottom: 0;
    opacity: 1;
  }
}
然后只需在

开放模式
&时代;
关于
康泰多
接近
这是小提琴:


请确保它是跨浏览器的,但这只是动画的基础,希望它能满足您的要求。

谢谢,但这会加载一个不同的CSS文件,并且不会从下面向上滑动。您可以将w3 animate top更改为w3 animate bottom,W3CSS代码的完整列表在这里:再次感谢您,但正如我所说,我不想在Bootstrap4之上添加另一个框架。
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<button type="submit" class="btn btn-block btn-default footer__btn" data-toggle="modal" data-target="#myModal2"> Open Modal</button>
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content w3-animate-bottom">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel"> ABOUT </h4>
      </div>
      <div class="modal-body">
        CONTEÚDO
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

      </div>
    </div>
  </div>
</div>
.modal.fade .modal-dialog {
    -webkit-transform: translate(0,100%);
    -ms-transform: translate(0,100%);
    -o-transform: translate(0,100%);
    transform: translate(0,100%);
}
.animate-bottom {
  position: relative;
  animation: animatebottom 0.4s;
}

@keyframes animatebottom {
  from {
    bottom: -300px;
    opacity: 0;
  }

  to {
    bottom: 0;
    opacity: 1;
  }
}
<button type="submit" class="btn btn-block btn-default footer__btn" data-toggle="modal" data-target="#myModal2"> Open Modal</button>
<div class="modal fade animate" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content animate-bottom"> <!-- Here you have the juicy hahah -->
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel"> ABOUT </h4>
      </div>
      <div class="modal-body">
        CONTEÚDO
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

      </div>
    </div>
  </div>
</div>