Twitter Bootstrap Modal幻灯片

时间:2013-04-25 17:11:09

标签: javascript jquery ruby-on-rails twitter-bootstrap modal-dialog

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

我一直在关注this link,但似乎无法看到如何实现滑入式转化,而不是褪色。

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

目前我有以下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%;
}

1 个答案:

答案 0 :(得分: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