examples/HTML StarterKit/lib/durandal/js/plugins/dialog.js
function(theDialog) {
            var body = $('body');
            var blockout = $('<div class="modalBlockout"></div>')
                .css({ 'z-index': dialog.getNextZIndex(), 'opacity': this.blockoutOpacity })
                .appendTo(body);

            var host = $('<div class="modalHost"></div>')
                .css({ 'z-index': dialog.getNextZIndex() })
                .appendTo(body);

            theDialog.host = host.get(0);
            theDialog.blockout = blockout.get(0);

            if (!dialog.isOpen()) {
                theDialog.oldBodyMarginRight = body.css("margin-right");
                theDialog.oldInlineMarginRight = body.get(0).style.marginRight;

                var html = $("html");
                var oldBodyOuterWidth = body.outerWidth(true);
                var oldScrollTop = html.scrollTop();
                $("html").css("overflow-y", "hidden");
                var newBodyOuterWidth = $("body").outerWidth(true);
                body.css("margin-right", (newBodyOuterWidth - oldBodyOuterWidth + parseInt(theDialog.oldBodyMarginRight, 10)) + "px");
                html.scrollTop(oldScrollTop); // necessary for Firefox
            }
        }
function(theDialog) {
            var body = $('body');
            var blockout = $('<div class="modalBlockout"></div>')
                .css({ 'z-index': dialog.getNextZIndex(), 'opacity': this.blockoutOpacity })
                .appendTo(body);

            var host = $('<div class="modalHost"></div>')
                .css({ 'z-index': dialog.getNextZIndex() })
                .appendTo(body);

            theDialog.host = host.get(0);
            theDialog.blockout = blockout.get(0);

            if (!dialog.isOpen()) {
                theDialog.oldBodyMarginRight = body.css("margin-right");
                theDialog.oldInlineMarginRight = body.get(0).style.marginRight;

                var html = $("html");
                var oldBodyOuterWidth = body.outerWidth(true);
                var oldScrollTop = html.scrollTop();
                $("html").css("overflow-y", "hidden");
                var newBodyOuterWidth = $("body").outerWidth(true);
                body.css("margin-right", (newBodyOuterWidth - oldBodyOuterWidth + parseInt(theDialog.oldBodyMarginRight, 10)) + "px");
                html.scrollTop(oldScrollTop); // necessary for Firefox
            }
        }
function ( theDialog ) { var body = $ ( 'body' ) ; var blockout = $ ( '<div class="modalBlockout"></div>' ) . css ( { 'z-index' : dialog . getNextZIndex ( ) , 'opacity' : this . blockoutOpacity } ) . appendTo ( body ) ; var host = $ ( '<div class="modalHost"></div>' ) . css ( { 'z-index' : dialog . getNextZIndex ( ) } ) . appendTo ( body ) ; theDialog . host = host . get ( 0 ) ; theDialog . blockout = blockout . get ( 0 ) ; if ( ! dialog . isOpen ( ) ) { theDialog . oldBodyMarginRight = body . css ( "margin-right" ) ; theDialog . oldInlineMarginRight = body . get ( 0 ) . style . marginRight ; var html = $ ( "html" ) ; var oldBodyOuterWidth = body . outerWidth ( true ) ; var oldScrollTop = html . scrollTop ( ) ; $ ( "html" ) . css ( "overflow-y" , "hidden" ) ; var newBodyOuterWidth = $ ( "body" ) . outerWidth ( true ) ; body . css ( "margin-right" , ( newBodyOuterWidth - oldBodyOuterWidth + parseInt ( theDialog . oldBodyMarginRight , 10 ) ) + "px" ) ; html . scrollTop ( oldScrollTop ) ; // necessary for Firefox } }
In this function, you are expected to add a DOM element to the tree which will serve as the "host" for the modal's composed view. You must add a property called host to the modalWindow object which references the dom element. It is this host which is passed to the composition module.
@method addHost
@param {Dialog} theDialog The dialog model.
In this function you are expected to add a DOM element to the tree which will serve as the host for the modal s composed view . You must add a property called host to the modalWindow object which references the dom element . It is this host which is passed to the composition module .