2017-02-16 15 views
0

私はページ上にモデルのポップアップを使用しています。私はページ上に200行のテーブルを持っています。私がクリックすると、各行モデルのポップアップが開きます。しかし、私はテーブルをスクロールし、行をクリックします。モデルのポップアップがページの上に開いています。私はテーブルの上をスクロールしてもページの中央に常に開いてほしい。モデルのポップアップをページの中央に固定する方法

私のCSSはここ

.modal { 
    position: absolute; 
    top: 30px; 
    right: 100px; 
    bottom: 0; 
    left: 0; 
    z-index: 10040; 
    overflow: auto; 
    overflow-y: auto; 
} 

答えて

0

ですが(:http://ud.ht/gLlFライブ):例です

<div class="modal" role="dialog" style="display: block;"> 
    <div class="modal-parent"> 
     <div class="modal-container"> 
      <div class="modal-contnet"> 
       <span class="modal-text" role="dialog-message">This is text</span> 
      </div> 
     </div> 
    </div> 
</div> 
ここ

は、CSSです:

.modal { 
    z-index: 10000; 
    position: fixed; 
    top: 0; 
    bottom: 0; 
    left: 0; 
    right: 0; 
    background-color: rgba(0,0,0,.7); 
    font-family: Tahoma; 
    overflow: auto; 
    overflow-y: scroll; 
    overflow-x: auto; 
    display: none; 
} 
.modal-parent { 
    display: table; 
    height: 100%; 
    table-layout: fixed; 
    width: 100%; 
} 
.modal-container { 
    display: table-cell; 
    text-align: center; 
    vertical-align: middle; 
    width: 100%; 
} 
.modal-contnet { 
    width: 450px; 
    display: inline-block; 
    position: relative; 
    text-align: right; 
    background-color: #eee; 
    margin: 20px 0; 
} 
.modal-text { 
    padding: 20px 25px; 
    font-family: Tahoma; 
    font-size: 12px; 
    display: block; 
    direction: rtl; 
    text-align: center; 
    line-height: 20px; 
} 
0
.modal { 
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0; 
    display: block; 
    z-index: 999; 
} 
.modal-body { 
    margin-top: 30px; 
    margin-left: auto; 
    margin-right: auto; 
    width: 600px; 
    min-height: 20px; 
} 

<div class="modal"> 
    <div class="modal-body"> 
    <p>Your content here</p> 
    </div> 
</div 

希望、これを試してみてくださいこれはあなたを助ける

関連する問題