Module-documentation

version 1.0.0
module: drag
maintanance: Marco Asbreuk
home
all modules

Constrained to window

Draggable elements can be constrained to the 'window' by setting the attribute constrain-selector="window", or using javascript by using node.plugin(ITSA.Plugins.NodeConstrain). The plugin does nothing more than add the right attribute to the draggable Element, and it just works.

Drag the 2 rectangles: they will be constrained inside the window. The first is constrained using html, the second is set up using javascript.

Code-example:

<body>
    <div class="container" plugin-dd="true" plugin-constrain="true" constrain-selector="window"></div>
    <div id="without" class="container" plugin-dd="true"></div>
</body>
<script src="itsabuild-min.js"></script>
<script>
    document.getElement('#without').plug('constrain');
</script>
API Docs