jsMind

mode Option

Option Name Data Type Default Value Description
mode string ‘full’ Layout mode

Usage

The mode parameter is used to control the layout of first-level child nodes in the mind map. jsMind provides two layout modes:

It is important to note that the mode parameter only affects nodes added through the add_node method. If the direction parameter is specified when using the add_node method, the direction specified in the direction parameter will take precedence.

Example Code

<div id="jsmind_container"></div>
<script>
    var options = {
        container: 'jsmind_container',
        editable: true,
        theme: 'primary',
        mode: 'full', // Set layout mode to full
    };
    var mind = new jsMind(options);
</script>

Notes

Initial Layout

When constructing mind map data, you can set the position of nodes using the direction field in the data format. The direction field specifies the position of the node relative to its parent node, with common values being:

Example Code (Initial Layout)

<div id="jsmind_container"></div>
<script>
    var mind_data = {
        "meta": {
            "name": "example",
            "author": "jsMind",
            "version": "0.2"
        },
        "format": "node_tree",
        "data": {
            "id": "root",
            "topic": "Root",
            "children": [
                { "id": "sub1", "topic": "Sub1", "direction": "left" }, // Set child node on the left
                { "id": "sub2", "topic": "Sub2", "direction": "right" } // Set child node on the right
            ]
        }
    };

    var options = {
        container: 'jsmind_container',
        editable: true,
        theme: 'primary'
    };
    var mind = new jsMind(options);
    mind.show(mind_data);
</script>

Related Article

copyright notice

Reproduction and deduction are prohibited.

The jsMind project is still being updated and the corresponding documentation is updated at the same time as the version is updated. In order to avoid confusion to the user, it is forbidden to reprint this document without written permission and to make changes of any kind to this document.