How is it possible for a jquery UI dialog to follow window scroll ?
It is possible but you need to override the base jQueryUI styles, so make sure (in your CSS) you have:
.ui-dialog {
position: fixed !important;
}
Here is an example:
$(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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With