dist/toolkit.js
function(parent) {
        var menu = parent.children(this.ns('menu'));

        if (!menu) {
            return;
        }

        menu.aria({
            expanded: true,
            hidden: true
        });

        // Alter width because of columns
        var children = menu.children();

        menu.css('width', (children.outerWidth() * children.length) + 'px');

        // Get sizes after menu positioning
        var win = $(window),
            winHeight = win.height() + win.scrollTop(),
            parentOffset = parent.offset(),
            parentHeight = parent.outerHeight(),
            oppositeClass = 'push-opposite';

        // Display menu horizontally on opposite side if it spills out of viewport
        if (Toolkit.isRTL) {
            if ((parentOffset.left - menu.outerWidth()) < 0) {
                menu.addClass(oppositeClass);
            } else {
                menu.removeClass(oppositeClass);
            }
        } else {
            if ((parentOffset.left + parent.outerWidth() + menu.outerWidth()) >= win.width()) {
                menu.addClass(oppositeClass);
            } else {
                menu.removeClass(oppositeClass);
            }
        }

        // Reverse menu vertically if below half way fold
        if (parentOffset.top > (winHeight / 2)) {
            menu.css('top', '-' + (menu.outerHeight() - parentHeight) + 'px');
        } else {
            menu.css('top', 0);
        }

        parent.addClass('is-open');
        menu.reveal();

        this.fireEvent('showChild', [parent]);
    }
function(parent) {
        var menu = parent.children(this.ns('menu'));

        if (!menu) {
            return;
        }

        menu.aria({
            expanded: true,
            hidden: true
        });

        // Alter width because of columns
        var children = menu.children();

        menu.css('width', (children.outerWidth() * children.length) + 'px');

        // Get sizes after menu positioning
        var win = $(window),
            winHeight = win.height() + win.scrollTop(),
            parentOffset = parent.offset(),
            parentHeight = parent.outerHeight(),
            oppositeClass = 'push-opposite';

        // Display menu horizontally on opposite side if it spills out of viewport
        if (Toolkit.isRTL) {
            if ((parentOffset.left - menu.outerWidth()) < 0) {
                menu.addClass(oppositeClass);
            } else {
                menu.removeClass(oppositeClass);
            }
        } else {
            if ((parentOffset.left + parent.outerWidth() + menu.outerWidth()) >= win.width()) {
                menu.addClass(oppositeClass);
            } else {
                menu.removeClass(oppositeClass);
            }
        }

        // Reverse menu vertically if below half way fold
        if (parentOffset.top > (winHeight / 2)) {
            menu.css('top', '-' + (menu.outerHeight() - parentHeight) + 'px');
        } else {
            menu.css('top', 0);
        }

        parent.addClass('is-open');
        menu.reveal();

        this.fireEvent('showChild', [parent]);
    }
function ( parent ) { var menu = parent . children ( this . ns ( 'menu' ) ) ; if ( ! menu ) { return ; } menu . aria ( { expanded : true , hidden : true } ) ; // Alter width because of columns var children = menu . children ( ) ; menu . css ( 'width' , ( children . outerWidth ( ) * children . length ) + 'px' ) ; // Get sizes after menu positioning var win = $ ( window ) , winHeight = win . height ( ) + win . scrollTop ( ) , parentOffset = parent . offset ( ) , parentHeight = parent . outerHeight ( ) , oppositeClass = 'push-opposite' ; // Display menu horizontally on opposite side if it spills out of viewport if ( Toolkit . isRTL ) { if ( ( parentOffset . left - menu . outerWidth ( ) ) < 0 ) { menu . addClass ( oppositeClass ) ; } else { menu . removeClass ( oppositeClass ) ; } } else { if ( ( parentOffset . left + parent . outerWidth ( ) + menu . outerWidth ( ) ) >= win . width ( ) ) { menu . addClass ( oppositeClass ) ; } else { menu . removeClass ( oppositeClass ) ; } } // Reverse menu vertically if below half way fold if ( parentOffset . top > ( winHeight / 2 ) ) { menu . css ( 'top' , '-' + ( menu . outerHeight ( ) - parentHeight ) + 'px' ) ; } else { menu . css ( 'top' , 0 ) ; } parent . addClass ( 'is-open' ) ; menu . reveal ( ) ; this . fireEvent ( 'showChild' , [ parent ] ) ; }
Event handler to position the child menu dependent on the position in the page.

@private
@param {jQuery} parent
Event handler to position the child menu dependent on the position in the page .