c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
Css

jQuery ui popup dialog position fixed on scroll?

| | Css , JQuery

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">
.fixed-dialog{
  position: fixed;
  top: 50px;
  left: 50px;
}
</style>

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

<
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 />
    </div>
</div>

Description: 

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



modal window in jquery position fixed