0
   /**
     * Opens a new modal dialog
     * This is for items that are scrollable
     * @param divIdFront the div element of modal dialog.
     * @param divIdBack the background screen element div (so we can grey out).  
     */
    function navCenterModalOpenScroll(divIdFront, divIdBack) {
        if ($(divIdBack).length) {
            $(divIdBack).height($(document).height());
            $(divIdBack).width($(document).width());
            $(divIdBack).show();
        }

        if ($(divIdFront).length) {
            var frontElem, x, y;
            frontElem = $(divIdFront);
            x = parseFloat($(window).width() - frontElem.outerWidth()) / 2;
            y = parseFloat($(window).height() - frontElem.outerHeight()) / 2;

            x = (x > 0) ? x : 0;
            y = (y > 0) ? y : 0;

            x += $(document).scrollLeft();
            y += $(document).scrollTop();

            frontElem.css("left", x);
            frontElem.css("top", y);

            frontElem.show();
            if (!document.all) {
                frontElem.focus();
            }

            $('body').css("overflow", "auto");
        }
    }

<div align="center" id="divIdFront" class="frameFront header" style="display:none;">
    <table width="365px"></table>
</div>

<div id="divIdBack" class="frameBack"></div>

这不再居中,而是始终出现在屏幕的左上角。

4

0 回答 0