2017-04-08 11 views
1

でブートストラップモーダル。今私は、画面の下部にあるユーザーにブートストラップモーダル表示アクションを作成する方法の方法を探しています。彼らは通常のモーダルと同じように動作します。私はmaterializecssのBottom Sheet Modalのように振る舞うモーダルを探しています。 これはブートストラップで可能ですか?それとも既存の方法がありますか?私は今、私は<strong>ブートストラップ</strong>に</strong>を切り替える<strong>ウェブサイトのため<strong>材料設計</strong>を使用する私の最後のプロジェクトのためにボトムシート

答えて

1

はい、それはですが、あなたは少しCSSモーダルを変更する必要があります。

注:あなたがする必要がある唯一の変更は、要素class="modal-dialog"

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <title>Bootstrap Example</title> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script> 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
</head> 
<body> 

<div class="container"> 
    <h2>Modal Example</h2> 
    <!-- Trigger the modal with a button --> 
    <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button> 

    <!-- Modal --> 
    <div class="modal fade" id="myModal" role="dialog" > 
    <div class="modal-dialog" style="position:absolute;bottom:0;margin:0;width:100%;"> 

     <!-- Modal content--> 
     <div class="modal-content"> 
     <div class="modal-header"> 
      <button type="button" class="close" data-dismiss="modal">&times;</button> 
      <h4 class="modal-title">Modal Header</h4> 
     </div> 
     <div class="modal-body"> 
      <p>Some text in the modal.</p> 
     </div> 
     <div class="modal-footer"> 
      <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> 
     </div> 
     </div> 

    </div> 
    </div> 

</div> 

</body> 
</html> 

例にスタイルを追加していますfrom:https://www.w3schools.com/bootstrap/bootstrap_modal.asp

+0

よろしくお願いいたします。私はこれを全幅にする必要があります。 –

+1

は既に全幅に私のコードを編集しました(:ちょうど必要な幅を追加する:100%; – DsEsteban