After JQuery UI dialog is closed, the page remains grayed out

I have an JQuery UI dialog on my page and it unwanted scrollbars I want to get rid of. Resizing the dialog did not help and neither did setting maxHeight and maxWidth

    <!DOCTYPE html>
        <meta charset="utf-8" />
        <link href="Content/themes/base/jquery-ui.css" rel="stylesheet" />
        <script src="Scripts/jquery-1.6.4.js"></script>
        <script src="Scripts/jquery-ui-1.11.4.js"></script>
            $(document).ready(function () {
                $(".hlk1").click(function () {
                    var linkId = $(this).attr("linkID");
                    // initialize dialog
                    var dlg = $("#dialog").dialog({
                        autoOpen: false,
                        modal: true,
                        draggable: false,
                        resizable: false,
                        position: { my: "center", at: "center", of: window },
                        height: 380,
                        width: 530,
                        maxHeight: 450,
                    maxWidth: 600,
                    open: function(){
                        $('body').css('overflow', 'hidden');
                        $('.ui-widget-overlay').css('width', '100%‌​');
                        $('.ui-widget-overlay').css('height', '100%');
                    close: function () {
                        $('body').css('overflow', 'auto');

                // load content and open dialog
                dlg.load('page2.html?id=' + linkId).dialog('open');

    <a href="#" class="hlk1" linkid="305">Click here</a>
    <a href="#" class="hlk1" linkid="890">Click here</a>
    <div id="dialog"></div>

Open in new window

LVL 35
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
Here is your code (

What I am looking for?
YZlatAuthor Commented:
Julian, this is strange, your code does not ass scrollbars but mine does
Julian HansenCommented:
Without seeing the code as a link where we can see what is happening have to go on the premise that the code posted is correct and there is something you have not given us.

Can you give us a link?
YZlatAuthor Commented:
I figure it out - there were right-aligned controls on the page that should have appeared in the dialog box, so the target page was larger than specified size, hence the scrollbars

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
YZlatAuthor Commented:
resolved it myself
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.