3

jquery UIダイアログがウィンドウスクロールに追従することはどのように可能ですか?

4

1 に答える 1

3

可能ですが、基本の jQueryUI スタイルをオーバーライドする必要があるため、(CSS で) 次のことを確認してください。

.ui-dialog {
    position: fixed !important;
}

次に例を示します。

$(function() {
  $("#dialog-modal").dialog({
    height: 140,
    modal: true
  });
});
body {
  height: 3000px;
  }

p {
  margin-bottom: 300px;
  }

.ui-dialog {
  position: fixed !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<link href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>


<div id="dialog-modal" title="Basic modal dialog">
  <p>Adding the modal overlay screen makes the dialog look more prominent because it dims out the page content.</p>
</div>


<!--these are here to help show that the dialogue is actually fixed -->
<p>A</p>
<p>B</p>
<p>C</p>
<p>D</p>
<p>E</p>
<p>F</p>

于 2013-10-14T10:04:07.430 に答える