Twitter Bootstrap modal: How to remove Slide down effect

前端 未结 16 2169
野趣味
野趣味 2020-12-07 11:38

Is there a way to change the Twitter Bootstrap Modal window animation from a slide down effect to a fadeIn or just display without the Slide? I read through the documentatio

16条回答
  •  感情败类
    2020-12-07 12:33

    I believe that most of these answers are for bootstrap 2. I ran into the same issue for bootstrap 3 and wanted to share my fix. Like my previous answer for bootstrap 2, this will still do an opacity fade, but will NOT do the slide transition.

    You can either change the modals.less or the theme.css files, depending on your workflow. If you haven't spent any quality time with less, I'd highly recommend it.

    for less, find the following code in MODALS.less

    &.fade .modal-dialog {
      .translate(0, -25%);
      .transition-transform(~"0.3s ease-out");
    }
    &.in .modal-dialog { .translate(0, 0)}
    

    then change the -25% to 0%

    Alternatively, if you're using just the css, find the following in theme.css:

    .modal.fade .modal-dialog {
      -webkit-transform: translate(0, -25%);
      -ms-transform: translate(0, -25%);
      transform: translate(0, -25%);
      -webkit-transition: -webkit-transform 0.3s ease-out;
      -moz-transition: -moz-transform 0.3s ease-out;
      -o-transition: -o-transform 0.3s ease-out;
      transition: transform 0.3s ease-out;
    }
    

    and then change the -25% to 0%.

提交回复
热议问题