public/javascripts/yui/container/container.js
function () {

            var nViewportOffset = Overlay.VIEWPORT_OFFSET,
                elementWidth = this.element.offsetWidth,
                elementHeight = this.element.offsetHeight,
                viewPortWidth = Dom.getViewportWidth(),
                viewPortHeight = Dom.getViewportHeight(),
                x,
                y;

            if (elementWidth < viewPortWidth) {
                x = (viewPortWidth / 2) - (elementWidth / 2) + Dom.getDocumentScrollLeft();
            } else {
                x = nViewportOffset + Dom.getDocumentScrollLeft();
            }

            if (elementHeight < viewPortHeight) {
                y = (viewPortHeight / 2) - (elementHeight / 2) + Dom.getDocumentScrollTop();
            } else {
                y = nViewportOffset + Dom.getDocumentScrollTop();
            }

            this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
            this.cfg.refireEvent("iframe");

            if (UA.webkit) {
                this.forceContainerRedraw();
            }
        }
function () {

            var nViewportOffset = Overlay.VIEWPORT_OFFSET,
                elementWidth = this.element.offsetWidth,
                elementHeight = this.element.offsetHeight,
                viewPortWidth = Dom.getViewportWidth(),
                viewPortHeight = Dom.getViewportHeight(),
                x,
                y;

            if (elementWidth < viewPortWidth) {
                x = (viewPortWidth / 2) - (elementWidth / 2) + Dom.getDocumentScrollLeft();
            } else {
                x = nViewportOffset + Dom.getDocumentScrollLeft();
            }

            if (elementHeight < viewPortHeight) {
                y = (viewPortHeight / 2) - (elementHeight / 2) + Dom.getDocumentScrollTop();
            } else {
                y = nViewportOffset + Dom.getDocumentScrollTop();
            }

            this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
            this.cfg.refireEvent("iframe");

            if (UA.webkit) {
                this.forceContainerRedraw();
            }
        }
function ( ) { var nViewportOffset = Overlay . VIEWPORT_OFFSET , elementWidth = this . element . offsetWidth , elementHeight = this . element . offsetHeight , viewPortWidth = Dom . getViewportWidth ( ) , viewPortHeight = Dom . getViewportHeight ( ) , x , y ; if ( elementWidth < viewPortWidth ) { x = ( viewPortWidth / 2 ) - ( elementWidth / 2 ) + Dom . getDocumentScrollLeft ( ) ; } else { x = nViewportOffset + Dom . getDocumentScrollLeft ( ) ; } if ( elementHeight < viewPortHeight ) { y = ( viewPortHeight / 2 ) - ( elementHeight / 2 ) + Dom . getDocumentScrollTop ( ) ; } else { y = nViewportOffset + Dom . getDocumentScrollTop ( ) ; } this . cfg . setProperty ( "xy" , [ parseInt ( x , 10 ) , parseInt ( y , 10 ) ] ) ; this . cfg . refireEvent ( "iframe" ) ; if ( UA . webkit ) { this . forceContainerRedraw ( ) ; } }
Centers the container in the viewport.
@method center
Centers the container in the viewport .