Skip to content
Kevin Dalman edited this page Dec 19, 2016 · 4 revisions

Layout Options as of 1.4.3

The Layout options documentation is badly out of date, so below is a copy of the current default options. This is copied verbatim from the uncompressed source-code, including all comments. Note that Layout uses leading-comma code style internally.

// DEFAULT OPTIONS
$.layout.defaults = {

/*
* LAYOUT & LAYOUT-CONTAINER OPTIONS
* - none of these options are applicable to individual panes
*/
    name:                       ""          // Not required, but useful for buttons and used for the state-cookie
,   containerClass:             "ui-layout-container" // layout-container element
,   inset:                      null        // custom container-inset values (override padding)
,   initPanes:                  true        // false = DO NOT initialize the panes onLoad - will init later
,   scrollToBookmarkOnLoad:     true        // after creating a layout, scroll to bookmark in URL (.../page.htm#myBookmark)
,   resizeWithWindow:           true        // bind thisLayout.resizeAll() to the window.resize event
,   resizeWithWindowDelay:      200         // delay calling resizeAll because makes window resizing very jerky
,   resizeWithWindowMaxDelay:   0           // 0 = none - force resize every XX ms while window is being resized
,   maskPanesEarly:             false       // true = create pane-masks on resizer.mouseDown instead of waiting for resizer.dragstart
,   showErrorMessages:          true        // enables fatal error messages to warn developers of common errors
,   showDebugMessages:          false       // display console-and-alert debug msgs - IF this Layout version _has_ debugging code!

// LAYOUT-LEVEL CALLBACKS
,   onresizeall_start:          null        // CALLBACK when resizeAll() STARTS    - NOT pane-specific
,   onresizeall_end:            null        // CALLBACK when resizeAll() ENDS    - NOT pane-specific
,   onload_start:               null        // CALLBACK when Layout inits - after options initialized, but before elements
,   onload_end:                 null        // CALLBACK when Layout inits - after EVERYTHING has been initialized
,   onunload_start:             null        // CALLBACK when Layout is destroyed OR onWindowUnload
,   onunload_end:               null        // CALLBACK when Layout is destroyed OR onWindowUnload

// Z-INDEX SETTINGS
// Changing this zIndex value will cause other zIndex values to automatically change
,   zIndex:                     null        // the PANE zIndex - resizers and masks will be +1
// DO NOT CHANGE the zIndex values below unless you clearly understand their relationships
,   zIndexes: {                             // set _default_ z-index values here...
        pane_normal:            0           // normal z-index for panes
    ,   content_mask:           1           // applied to overlays used to mask content INSIDE panes during resizing
    ,   resizer_normal:         2           // normal z-index for resizer-bars
    ,   pane_sliding:           100         // applied to *BOTH* the pane and its resizer when a pane is 'slid open'
    ,   pane_animate:           1000        // applied to the pane when being animated - not applied to the resizer
    ,   resizer_drag:           10000       // applied to the CLONED resizer-bar when being 'dragged'
    }

// ERROR MESSAGES
,   errors: {
        pane:                   "pane"      // description of "layout pane element" - used only in error messages
    ,   selector:               "selector"  // description of "jQuery-selector" - used only in error messages
    ,   addButtonError:         "Error Adding Button\nInvalid "
    ,   containerMissing:       "UI Layout Initialization Error\nThe specified layout-container does not exist."
    ,   centerPaneMissing:      "UI Layout Initialization Error\nThe center-pane element does not exist.\nThe center-pane is a required element."
    ,   noContainerHeight:      "UI Layout Initialization Warning\nThe layout-container \"CONTAINER\" has no height.\nTherefore the layout is 0-height and hence 'invisible'!"
    ,   callbackError:          "UI Layout Callback Error\nThe EVENT callback is not a valid function."
    }

/*
 * PANE DEFAULT SETTINGS
 * - settings under the 'panes' key become the default settings for *all panes*
 * - ALL pane-options can also be set specifically for each panes, which will override these 'default values'
 */
,   panes: {
        applyDemoStyles:        false       // NOTE: renamed from applyDefaultStyles for clarity
    ,   closable:               true        // pane can open & close
    ,   resizable:              true        // when open, pane can be resized
    ,   slidable:               true        // when closed, pane can 'slide open' over other panes - closes on mouse-out
    ,   initClosed:             false       // true = init pane as 'closed'
    ,   initHidden:             false       // true = init pane as 'hidden' - no resizer-bar/spacing

    //  ELEMENT SELECTORS
    //, paneSelector:           ""          // MUST be pane-specific - jQuery selector for pane
    ,   contentSelector:        ".ui-layout-content" // INNER div/element to auto-size so only it scrolls, not the entire pane!
    ,   contentIgnoreSelector:  ".ui-layout-ignore" // element(s) to 'ignore' when measuring 'content'
    ,   findNestedContent:      false       // true = $P.find(contentSelector), false = $P.children(contentSelector)

    // GENERIC ROOT-CLASSES - for auto-generated classNames
    ,   paneClass:              "ui-layout-pane"    // Layout Pane
    ,   resizerClass:           "ui-layout-resizer" // Resizer Bar
    ,   togglerClass:           "ui-layout-toggler" // Toggler Button
    ,   buttonClass:            "ui-layout-button"  // CUSTOM Buttons, eg: '[ui-layout-button]-toggle/-open/-close/-pin'

    // ELEMENT SIZE & SPACING
    //, size:                   100         // MUST be pane-specific -initial size of pane
    ,   minSize:                0           // when manually resizing a pane
    ,   maxSize:                0           // ditto, 0 = no limit
    ,   spacing_open:           6           // space between pane and adjacent panes - when pane is 'open'
    ,   spacing_closed:         6           // ditto - when pane is 'closed'
    ,   togglerLength_open:     50          // Length = WIDTH of toggler button on north/south sides - HEIGHT on east/west sides
    ,   togglerLength_closed:   50          // 100% OR -1 means 'full height/width of resizer bar' - 0 means 'hidden'
    ,   togglerAlign_open:      "center"    // top/left, bottom/right, center, OR...
    ,   togglerAlign_closed:    "center"    // 1 => nn = offset from top/left, -1 => -nn == offset from bottom/right
    ,   togglerContent_open:    ""          // text or HTML to put INSIDE the toggler
    ,   togglerContent_closed:  ""          // ditto

    // RESIZING OPTIONS
    ,   resizerDblClickToggle:  true        //
    ,   autoResize:             true        // IF size is 'auto' or a percentage, then recalc 'pixel size' whenever the layout resizes
    ,   autoReopen:             true        // IF a pane was auto-closed due to noRoom, reopen it when there is room? False = leave it closed
    ,   resizerDragOpacity:     1           // option for ui.draggable
    //, resizerCursor:          ""            // MUST be pane-specific - cursor when over resizer-bar
    ,   maskContents:           false       // true = add DIV-mask over-or-inside this pane so can 'drag' over IFRAMES
    ,   maskObjects:            false       // true = add IFRAME-mask over-or-inside this pane to cover objects/applets - content-mask will overlay this mask
    ,   maskZindex:             null        // will override zIndexes.content_mask if specified - not applicable to iframe-panes
    ,   resizingGrid:           false       // grid size that the resizers will snap-to during resizing, eg: [20,20]
    ,   livePaneResizing:       false       // true = LIVE Resizing as resizer is dragged
    ,   liveContentResizing:    false       // true = re-measure header/footer heights as resizer is dragged
    ,   liveResizingTolerance:  1           // how many px change before pane resizes, to control performance

     // SLIDING OPTIONS
    ,   sliderCursor:           "pointer"   // cursor when resizer-bar will trigger 'sliding'
    ,   slideTrigger_open:      "click"     // click, dblclick, mouseenter
    ,   slideTrigger_close:     "mouseleave" // click, mouseleave
    ,   slideDelay_open:        300         // applies only for mouseenter event - 0 = instant open
    ,   slideDelay_close:       300         // applies only for mouseleave event (300ms is the minimum!)
    ,   hideTogglerOnSlide:     false       // when pane is slid-open, should the toggler show?
    ,   preventQuickSlideClose: $.layout.browser.webkit // Chrome triggers slideClosed as it is opening
    ,   preventPrematureSlideClose: false   // handle incorrect mouseleave trigger, like when over a SELECT-list in IE

    // PANE-SPECIFIC TIPS & MESSAGES
    ,   tips: {
            Open:               "Open"      // eg: "Open Pane"
        ,   Close:              "Close"
        ,   Resize:             "Resize"
        ,   Slide:              "Slide Open"
        ,   Pin:                "Pin"
        ,   Unpin:              "Un-Pin"
        ,   noRoomToOpen:       "Not enough room to show this panel."    // alert if user tries to open a pane that cannot
        ,   minSizeWarning:     "Panel has reached its minimum size"    // displays in browser statusbar
        ,   maxSizeWarning:     "Panel has reached its maximum size"    // ditto
        }

    // HOT-KEYS & MISC
    ,   showOverflowOnHover:    false       // will bind allowOverflow() utility to pane.onMouseOver
    ,   enableCursorHotkey:     true        // enabled 'cursor' hotkeys
    //, customHotkey:           ""          // MUST be pane-specific - EITHER a charCode OR a character
    ,   customHotkeyModifier:   "SHIFT"     // either 'SHIFT', 'CTRL' or 'CTRL+SHIFT' - NOT 'ALT'

    // PANE ANIMATION
    // NOTE: fxSss_open, fxSss_close & fxSss_size options (eg: fxName_open) are auto-generated if not passed
    ,   fxName:                 "slide"     // ('none' or blank), slide, drop, scale -- only relevant to 'open' & 'close', NOT 'size'
    ,   fxSpeed:                null        // slow, normal, fast, 200, nnn - if passed, will OVERRIDE fxSettings.duration
    ,   fxSettings:             {}          // can be passed, eg: { easing: "easeOutBounce", duration: 1500 }
    ,   fxOpacityFix:           true        // tries to fix opacity in IE to restore anti-aliasing after animation
    ,   animatePaneSizing:      false       // true = animate resizing after dragging resizer-bar OR sizePane() is called
    /* NOTE: Action-specific FX options are auto-generated from the options above if not specifically set:
    ,   fxName_open:            "slide"     // 'Open' pane animation
    ,   fnName_close:           "slide"     // 'Close' pane animation
    ,   fxName_size:            "slide"     // 'Size' pane animation - when animatePaneSizing = true
    ,   fxSpeed_open:           null
    ,   fxSpeed_close:          null
    ,   fxSpeed_size:           null
    ,   fxSettings_open:        {}
    ,   fxSettings_close:       {}
    ,   fxSettings_size:        {}
    */

    // CHILD/NESTED LAYOUTS
    ,   children:               null        // Layout-options for nested/child layout - even {} is valid as options
    ,   containerSelector:      ''          // if child is NOT 'directly nested', a selector to find it/them (can have more than one child layout!)
    ,   initChildren:           true        // true = child layout will be created as soon as _this_ layout completes initialization
    ,   destroyChildren:        true        // true = destroy child-layout if this pane is destroyed
    ,   resizeChildren:         true        // true = trigger child-layout.resizeAll() when this pane is resized

    // EVENT TRIGGERING
    ,   triggerEventsOnLoad:    false       // true = trigger onopen OR onclose callbacks when layout initializes
    ,   triggerEventsDuringLiveResize: true // true = trigger onresize callback REPEATEDLY if livePaneResizing==true

    // PANE CALLBACKS
    ,   onshow_start:           null        // CALLBACK when pane STARTS to Show    - BEFORE onopen/onhide_start
    ,   onshow_end:             null        // CALLBACK when pane ENDS being Shown    - AFTER  onopen/onhide_end
    ,   onhide_start:           null        // CALLBACK when pane STARTS to Close    - BEFORE onclose_start
    ,   onhide_end:             null        // CALLBACK when pane ENDS being Closed    - AFTER  onclose_end
    ,   onopen_start:           null        // CALLBACK when pane STARTS to Open
    ,   onopen_end:             null        // CALLBACK when pane ENDS being Opened
    ,   onclose_start:          null        // CALLBACK when pane STARTS to Close
    ,   onclose_end:            null        // CALLBACK when pane ENDS being Closed
    ,   onresize_start:         null        // CALLBACK when pane STARTS being Resized ***FOR ANY REASON***
    ,   onresize_end:           null        // CALLBACK when pane ENDS being Resized ***FOR ANY REASON***
    ,   onsizecontent_start:    null        // CALLBACK when sizing of content-element STARTS
    ,   onsizecontent_end:      null        // CALLBACK when sizing of content-element ENDS
    ,   onswap_start:           null        // CALLBACK when pane STARTS to Swap
    ,   onswap_end:             null        // CALLBACK when pane ENDS being Swapped
    ,   ondrag_start:           null        // CALLBACK when pane STARTS being ***MANUALLY*** Resized
    ,   ondrag_end:             null        // CALLBACK when pane ENDS being ***MANUALLY*** Resized
    }

/*
 * PANE-SPECIFIC SETTINGS
 * - options listed below MUST be specified per-pane - they CANNOT be set under 'panes'
 * - all options under the 'panes' key can also be set specifically for any pane
 * - most options under the 'panes' key apply only to 'border-panes' - NOT the the center-pane
 */
,   north: {
        paneSelector:           ".ui-layout-north"
    ,   size:                   "auto"      // eg: "auto", "30%", .30, 200
    ,   resizerCursor:          "n-resize"  // custom = url(myCursor.cur)
    ,   customHotkey:           ""          // EITHER a charCode (43) OR a character ("o")
    }
,   south: {
        paneSelector:           ".ui-layout-south"
    ,   size:                   "auto"
    ,   resizerCursor:          "s-resize"
    ,   customHotkey:           ""
    }
,   east: {
        paneSelector:           ".ui-layout-east"
    ,   size:                   200
    ,   resizerCursor:          "e-resize"
    ,   customHotkey:           ""
    }
,   west: {
        paneSelector:           ".ui-layout-west"
    ,   size:                   200
    ,   resizerCursor:          "w-resize"
    ,   customHotkey:           ""
    }
,   center: {
        paneSelector:           ".ui-layout-center"
    ,   minWidth:               0
    ,   minHeight:              0
    }
};

Alternate Option Syntax

Layout also accepts options to be passed in flat-format, where all options are set as top-level keys. Sub-keys are indicated by using 2 underscores, like west__size. This format allows options to be set in any order. Most layout demos use this format so that related options to be logically grouped.

// Nested hash format
$.layout({
    west: {
        size:      300,
        tips: {
            Open:  "Show Menu",
            Close: "Hide Menu"
    },
    east: {
        size:      250,
        tips: {
            Open:  "Show Preview",
            Close: "Hide Preview"
    }
});

// Same options in flat-format
$.layout({
    west__size:        300,
    east__size:        250,
    west__tips__Open:  "Show Menu",
    west__tips__Close: "Hide menu",
    east__tips__Open:  "Show Preview",
    east__tips__Close: "Hide Preview",
});
Clone this wiki locally