JQuery Dialog Not Working Well If Page is Scrolled down

JQuery Dialog Not Working Well If Page is Scrolled down

Hi,

I have a page which has large contents.If I open the dialog when page is has been opened , the dialog is fine and it closes well.Now, If I have opened my main page and scrool down to page and at the end there is a link for opening dialog, then the dialog opens to current window position and page is scrolled up to top. Now dialog has been opened but  it is too below that i cant see it.

I have tested that when we scroll down the jquery function takes the scrooled position as its top position and so opening popup for that relative position.

My code is.

$dialog.dialog({
                title: title,
                autoOpen: true,
                width: width,
                height: height,
                modal: true,
                resizable: true,
                autoResize: false,
                position: [0,0],
                                             
                overlay: {
                    opacity: 0.3,
                    background: "black"
                }
            }).width(eval(eval(width) - horizontalPadding)).height(eval(eval(height) - verticalPadding));

How I can open it on top of page

Regards
Ulfat Hussain