I am using a jquery dialog to pop up a dialog.
What happens when the dialog opens is that it shows the dialog as expected, however it adds extra height to the page and on most screen resolutions this will cause a vertical scrollbar to appear on the browser. Obviously there is nothing to scroll down to see, so would very much prefer not to have the dynamic scrollbar. Ive tried positioning the dialog div all over the page, but I can’t get rid of it. It happens in ie and Firefox.
Here is a simplified version of the code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#divjQueryPopup').dialog({
autoOpen: false,
draggable: true,
width: 500,
open: function (type, data) {
$(this).parent().appendTo('form');
}
});
});
function showDialog(id) {
$('#' + id).dialog('open');
}
function closeDialog(id) {
$('#' + id).dialog('close');
}
</script>
<div style="height: 500px;">
<div style="height:500px;">
<input id="inpTest" type="button" value="Test" onclick="showDialog('divjQueryPopup');" />
</div>
<div id="divjQueryPopup" runat="server">
<div style="padding:10px 20px 10px 20px">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit,
sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat,
vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent
luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend
option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam;
est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me
lius quod ii legunt saepius. Claritas est etiam processus dynamicus,
qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica,
</div>
</div>
</div>
This is happening because the dialogue “appears” at the bottom of the screen and then has style
position: relativeandtop: -whatever pxto move it into position. This style is directly applied to the div.Div classes:
ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable ui-resizableDirectly applied style:
display: block; z-index: 1001; outline: 0px none; position: relative; height: auto; width: 500px; top: -535.5px; left: 540px;Instead, change the style to:
position: absolutewith a positive top.You can verify this by using firebug.