jQuery ui popup dialog position fixed on scroll?

jQuery ui popup dialog position fixed on scroll?, someone asked me to explain?

When a user opens a jquery ui popup, next he scrolls the page, the model popup window also moving. If you want to stay the model popup window fixed on the scroll. Then create a css class with fixed position,

jQuery dialog position example:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/blitzer/theme.css" rel="stylesheet" type="text/css" />

<style type="text/css">
  position: fixed;
  top: 50px;
  left: 50px;

$(function ()
            modal: true,
            autoOpen: false,
            title: "jQuery Dialog",
            resizable: false,
            draggable: true,
            width: 'auto',
            dialogClass: 'fixed-dialog'
$(".opener").click(function () {

button class="opener">open the dialog</button>
<div id="dialog1" title="Dialog Title" align="center" hidden="hidden">
    <div class="body">
        <img id="image" src="/image/koala.jpg"/>
        <br />


The following example works fine and fix the jQuery ui dialog box css scrolling issue.

modal window in jquery position fixed

Post your comments / questions