Q4Widgets API Documentation

q4.treemenu

An expanding tree-style table of contents for a set of content.
Script link
q4.treemenu.1.0.1.min.js
Source file
q4.treemenu.js, line 2
Requires

Options

openMultipleItems boolean
Whether opening a menu item will close its sibling items.
Default value
false
menuContainer string
A selector in the main template for the menu.
Default value
.menu
bodyContainer string
A selector in the main template the body content.
Default value
.body
submenu string
A selector in the menu item template for child menu items.
Default value
.submenu
trigger string
A selector in the menu item template to display the content.
Default value
.itemLink
expandTrigger string
A selector in the menu item template to toggle child items.
Default value
.itemExpand
expandText string
The text to display in a collapsed menu item's trigger.
Default value
[ + ]
collapseText string
The text to display in an expanded menu item's trigger.
Default value
[ - ]
itemClass string
A class to add to each menu item.
Default value
treemenu-item
activeClass string
A class to add to each menu item.
Default value
treemenu-active
expandedClass string
A class to add to an expanded menu item.
Default value
treemenu-expanded
template string
A Mustache template for the overall widget.
Example
'<ul class="menu"></ul>' +
'<div class="body"></div>'
menuItemTemplate string
A recursive Mustache template for each menu item.
Example
'<li>' +
    '<span class="itemExpand"></span>' +
    '<a class="itemLink" href="#">{{title}}</a>' +
    '<ul class="submenu"></ul>' +
'</li>'
bodyItemTemplate string
A Mustache template for each item's body content.
Example
'<div>' +
    '<h4>{{title}}</h4>' +
    '<div class="itemContent">{{{content}}}</div>' +
'</div>'
content
A nested array of menu item objects, each with these properties: - `title` The title to display in the menu. - `content` The body content to display when an item is clicked. - `items` An optional array of child menu items.
Example
[
    {
        title: 'Item 1',
        content: 'Item 1 content',
        items: [
            {
                title: 'Item 1.1',
                content: 'Item 1.1 content'
            }
        ]
    }
]