zoukankan      html  css  js  c++  java
  • Bootstrap3模态垂直居中

    
    
    1     <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    2         <div class="modal-dialog modal-lg">
    3             <div class="modal-content"></div><!-- /.modal-content -->
    4         </div><!-- /.modal -->
    5     </div>
    
    
    1         function openDialog() {
    2             var modal = $('#myModal').modal({ keyboard: false, backdrop: 'static'/*,remote: 'Detail?r=' + Math.random()*/ })
    3             modal.find('.modal-content').load('Detail', { R: Math.random() });
    4         }

    1
    $(function () { 2 function centerModals() { 3 $('#myModal').each(function (i) { 4 var $clone = $(this).clone().css('display', 'block').appendTo('body'); 5 var top = Math.round(($clone.height() - $clone.find('.modal-content').height()) / 2); 6 top = top > 0 ? top : 0; 7 $clone.remove(); 8 $(this).find('.modal-content').css("margin-top", top); 9 }); 10 } 11 if ($('#myModal').size() > 0) { 12 //$('#myModal').on('shown.bs.modal', centerModals); 13 //$(window).on('resize', centerModals); 14 setInterval(centerModals, 200); 15 } 16 });
  • 相关阅读:
    第十五章:字段与属性
    第二十章:封装与继承
    第二十一章;泛型List
    第十九章:对象初始化器
    第十八章:构造方式
    第十七章:方法的重载
    request和response对象常用方法
    面向对象(1)
    request和response
    tomcat
  • 原文地址:https://www.cnblogs.com/ToughGuy/p/4519980.html
Copyright © 2011-2022 走看看