Module-documentation

version 1.0.0
module: node-plugin
maintanance: Marco Asbreuk
home
all modules

Changing properties

Plugin-properties can be changed by using plugin.model. This example shows how the property selector can be changed.

Click on the button to change the draggable's constrain.




Code-example:

<body>
    <button id="switch" class="pure-button">Switch constrain</button>
    <div class="base-container">
        <div id="dragnode" class="container" plugin-dd="true" plugin-constrain="true" constrain-selector=".base-container"></div>
    </div>
</body>
<script src="itsabuild-min.js"></script>
<script>
    var dragnode = document.getElement('#dragnode'),
        constrained = true;

    ITSA.Event.after('tap', function() {
        constrained = !constrained;
        dragnode.getPlugin('constrain').then(
            function(plugin) {
                plugin.model.selector = constrained ? '.base-container' : 'window';
            }
        );
    }, '#switch');
</script>
API Docs