Why does opening a Shadobox.js scroll long windows to the top?

I have a really long page that is 1263px wide by 1880px high where opening a Shadowbox via button down at the bottom of the page causes the page to scroll all the way to top of page while the shadowbox centers itself vertically.

function DisplayAgreementWizard(selectedPort, yesSelector, noSelector, madeBy, madeByPos, madeOn)
{
    var baseUrl = resolveUrl('/ALLUSERS/Agreement.aspx');
    var actionUrl = resolveUrl('/Handlers/DataHandler.ashx');

    Shadowbox.init({ skipSetup: true });
    Shadowbox.open({
        content: baseUrl + '?port=' + selectedPort,
        player: 'iframe',
        height: 450,
        width: 750,
        options: {
            onOpen: function() {
                $  (yesSelector).focus(); // This prevents the shadowbox from scrolling to the top of the page
            },
            onClose: function() {
                $  .get(
                    actionUrl + '?port=' + selectedPort + '&func=getstate',
                    function(data, status) {
                        // Do stuff with the data handler after the shadowbox is done.
                    }
                );
            }
        }
    });
}

You may notice there’s an onOpen event handler there that calls $ (yesSelector).focus(). That stops the scroll to the top but the windows is still centered on the page.

How do I make the shadowbox center in the viewable area?

newest questions tagged jquery – Stack Overflow

About Admin