UNPKG

dojo

Version:

Dojo core is a powerful, lightweight library that makes common tasks quicker and easier. Animate elements, manipulate the DOM, and query with easy CSS syntax, all without sacrificing performance.

52 lines (47 loc) 1.72 kB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Dojo parent constraint test</title> <style type="text/css"> @import "../../resources/dojo.css"; body { padding: 1em; } .moveable { background: #FFFFBF; border: 1px solid black; width: 300px; padding: 10px 20px; cursor: pointer; } .parent { background: #BFECFF; border: 10px solid lightblue; width: 500px; height: 500px; padding: 10px; margin: 10px; } </style> <script type="text/javascript" src="../../dojo.js" data-dojo-config="isDebug: true"></script> <script type="text/javascript"> require(["dojo/dnd/move", "dojo/domReady!"], function(move){ var m1, m2, m3, m4; m1 = new move.parentConstrainedMoveable("moveable1", {area: "margin", within: true, delay: 20}); m2 = new move.parentConstrainedMoveable("moveable2", {area: "border", within: true}); m3 = new move.parentConstrainedMoveable("moveable3", {area: "padding", within: true}); m4 = new move.parentConstrainedMoveable("moveable4", {area: "content", within: true}); }); </script> </head> <body> <h1>Dojo parent constraint test</h1> <div class="parent" id="parent"> <div><strong>This is the parent element.</strong> All children will be restricted with <strong>within = true</strong>.</div> <div class="moveable" id="moveable1">I am restricted within my parent's margins.</div> <div class="moveable" id="moveable2">I am restricted within my parent's border.</div> <div class="moveable" id="moveable3">I am restricted within my parent's paddings.</div> <div class="moveable" id="moveable4">I am restricted within my parent's content.</div> </div> </body> </html>