1

有谁知道如何让 Twitter Bootstrap 模式从浏览器窗口顶部平滑滑入到位而不是快速淡入?

我一直在看这个链接,但似乎看不到如何实现滑入过渡而不是淡入淡出。

提前感谢您提供的任何帮助。

我目前有以下CSS:

.modal-backdrop.fade {
    opacity: 0;
}
.modal-backdrop, .modal-backdrop.fade.in {
    opacity: 0.8;
}
.modal {
    background-clip: padding-box;
    background-color: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.3);
    border-radius: 6px 6px 6px 6px;
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
    left: 50%;
    margin: -250px 0 0 -280px;
    max-height: 500px;
    overflow: auto;
    position: fixed;
    top: 50%;
    width: 560px;
    z-index: 1050;
}
.modal.fade {
    top: -25%;
    transition: opacity 0.3s linear 0s, top 0.3s ease-out 0s;
}
.modal.fade.in {
    top: 50%;
}
4

1 回答 1

0

w3resource 示例的问题是添加到#example div 的“in”类。如果您删除“in”类,它应该按照您期望从顶部滑入的方式工作......

<div class="container">  
  <h2>Example of creating Modals with Twitter Bootstrap</h2>  
  <div id="example" class="modal hide fade" style="display: none; ">  
  <div class="modal-header">  
  <a class="close" data-dismiss="modal">×</a>  
  <h3>This is a Modal Heading</h3>  
  </div>  
  <div class="modal-body">  
  <h4>Text in a modal</h4>  
  <p>You can add some text here.</p>                
  </div>  
  <div class="modal-footer">  
  <a href="#" class="btn btn-success">Call to action</a>  
  <a href="#" class="btn" data-dismiss="modal">Close</a>  
  </div>  
  </div>  
  <p><a data-toggle="modal" href="#example" class="btn btn-primary btn-large">Launch demo modal</a></p>  
</div>

在 Bootply 上工作:http : //www.bootply.com/60158

于 2013-04-27T11:03:46.863 回答