version 1.0.0
module: constrain version 0.0.1
size-min gzipped: 1.99 kb (incl. dependencies: 15.32 kb)
dependencies: polyfill/polyfill-base.js, js-ext/lib/function.js, js-ext/lib/object.js, utils, event
maintanance: Marco Asbreuk

all modules

Making an Element to constrain within boundaries

This module makes an Element to be constrained when dragged or repositioned.

Getting Started

With nodejs:

The module constrain is a typical browser-module.

In the browser:

For browser-usage, ITSA has a predefined loaderfiles. Once included, a global ITSA object with default features is available. For customized loaderfiles, read: Customized build.

<script src="/itsabuild-min.js"></script>
When using your own customized build-file, this module-requirement needs to be invoked with the window-object.

The Basics

The constrian-plugin makes an Element to constrain to another Element or window, specified by selector. This constrain-effect will be active whenever the Element is dragged or repositioned.

Setting up with HTML

The preferred way is to set the focusmanager through HTML, because you don't need client-side rendering:

Example simple constrian:

<div plugin-constrain="true"></div>

Example constrian with different selector:

<div plugin-constrain="true" constrain-selector=".container"></div>

Setting up with Plugin

A node can also be constrained by using the plugin which gets returned by the module (when required):

Example simple focusmanager by Plugin:

<div id=mynode></div>
    var ITSA = require('itsa'),
        mynode = document.getAll('#mynode');

API Docs