我使用bootstrap模态插件.但是中间没有显示模态对话框.
为什么?我的错?
为什么?我的错?
http://dl.dropbox.com/u/573972/stackoverflow/bootstrap/modal.html
<!DOCTYPE html> <head> <Meta charset="utf-8"> <title>test</title> <Meta name="description" content=""> <Meta name="author" content=""> <!-- Mobile Specific--> <Meta name="viewport" content="width=device-width,initial-scale=1.0"> <!-- css--> <link rel="stylesheet" href="bootstrap.min.css"> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/1.7/jquery.min.js'></script> </head> <body> <div id="login" class="modal"> <div class="modal-header"> <h3>Login to Room fuga</h3> </div> <div class="modal-body"> hogehoge </div> </div> <script src="bootstrap.min.js"> </script> <script> $('#login').modal(); </script> </body> </html>
解决方法
我发现这个workarround来解决这个问题:
$('#YourModal').modal().css( { 'margin-top': function () { return -($(this).height() / 2); } })