views:

30

answers:

1

I have a jQuery dialog defined as follows

<div id="emaildialog" title="Contact Us">
    <!-- Html.RenderPartial("ContactUs"); -->
    <div>This is a test</div>
</div>


<script type="text/javascript">
    (function ($) {
        // increase the default animation speed to exaggerate the effect
        $.fx.speeds._default = 1000;
        $(function() {
            $( "#emaildialog" ).dialog({
                autoOpen: false,
                show: "blind",
                hide: "explode",
                width: 700,
                modal: true,
                position: 'center'
            });

            $( "#viewselected" ).click(function() {
                $( "#emaildialog" ).dialog( "open" );
                return false;
            });
        });                
    })(jQuery);
</script>

When I click on the button that causes the dialog to show up, the dialog is centered in the middle of the screen, but it span the entire height of the we page. Specifically, the title bar itself stretches and the content at the bottom of the dialog seems fine.

Does anyone know what might be causing this and how to fix it?

I noticed one odd thing. If I click on the side of the dialog to resize the dialog, then it redraws itself properly, and upon inspecting the css I noticed that the dialog has it's position changed from relative to absolute, but this is all done inside jQuery UI, so I'm not sure how to fix this in my code.

The css I'm using is linked from google:

<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/
    1.7.2/themes/start/jquery-ui.css" type="text/css" rel="Stylesheet" />

You can see the site here for the css: http://dev.thinkterrabella.com/

+1  A: 

You dont need to specify the dialog width. If you remove it form the dialog setup function when the dialog will open it will size according to it's content and if bigger than the viewport it will have scrollbars.

as you're returning a partial view it's better not to specify it's size and let him choose the right one.

hope it helps!

Issue:

Why are you using jQueryUI 1.8.5 together with a theme from 1.7.2??? maybe something in the css is breaking your site. I advice you to change theme css pointing to the 1.8.5 release here: http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/themes/start/jquery-ui.css

Lorenzo
I actually added the width to try to fix the problem, taking it away isn't helping me right now. Also, I commented out the partial view to verify that it wasn't the problem.
Joseph
I posted my dev site so you can see the issue yourself http://dev.thinkterrabella.com/
Joseph
As other people pointed out it would be nice to see if some site css is breaking the dialog. Also can you please specify the jquery and jqueryui version used?
Lorenzo
@Lorenzo I added the site URL, the css is on the site. Do you need something else?
Joseph
Why are you using jQueryUI 1.8.5 together with a theme from 1.7.2??? maybe something in the css is breaking your site. I advice you to change theme css pointing to the 1.8.5 release here: `http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/themes/start/jquery-ui.css`
Lorenzo
@Lorenzo That was it! I should have been paying more attention when I copy pasted that code =P
Joseph
Glad to hear that helped!
Lorenzo