Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to center JQuery dialog box after browser resize
    primarykey
    data
    text
    <p><strong>What I'm trying to do:</strong> When my browser is maximized and I open the JQuery dialog, it opens it in the center as expected. However when I resize the browser to be slightly smaller than the width of the dialog and then open the dialog, it always opens it left-justified. With a chunk of space on the right.</p> <p><strong>Code</strong></p> <pre><code>$(document).ready(function() { var dlg = ''; dlg=$('#ticketDetails').dialog({ title: 'TICKET DETAILS', resizable: true, autoOpen:false, modal: true, show:'fast', hide: 'fade', buttons:{ "Close": function() { dlg.dialog("close"); } }, close: function(e, i) { dlg.hide(); }, width:1250 }); </code></pre> <p><strong>What I've tried:</strong></p> <pre><code>$(window).resize(function() { $('#ticketDetails').dialog({position: ['center', 'center']}); }); </code></pre> <p>I've read some of the answers and tried a few variations but nothing seems to work..</p> <p><strong>Further information:</strong></p> <p><a href="http://jsfiddle.net/39GqM/479/" rel="nofollow noreferrer">http://jsfiddle.net/39GqM/479/</a></p> <p>If you you scroll the bar in the middle all the way to the left and then run it you will notice that to view the dialog content on the right you need to drag it to the left by the title bar and only then the scroll bar will appear.</p> <p><strong>The following screen is when the browser is on full screen. As you can see the content fits perfectly:</strong> <img src="https://i.stack.imgur.com/4tUcV.jpg" alt="enter image description here"></p> <p><strong>Now the page has been resized and then I've opened the dialog. As you can see its left-justified. There is no scroll-bar and the only way to get the scroll bar is to drag the dialog left (via the cursor that appears on the title) for the scroll bar to appear. This is the only way to see the content on the right (start of the paragraph/ title).</strong> <img src="https://i.stack.imgur.com/FvRcv.jpg" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload