1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Test Dojo</title>
<style type="text/css">
<!--
#board {
border: 1px solid gray;
background: #ccc;
width: 300px;
height: 300px;
padding: 5px;
}
#red, #blue {
color: black;
border: black;
width: 40px;
height: 20px;
display: block;
text-align: center;
}
#red {
background: red;
}
#blue {
background: blue;
}
-->
</style>
<script type="text/javascript" src="js/dojo/dojo/dojo.js" djConfig="parseOnLoad: true"></script>
<script type="text/javascript">
<!--
dojo.require("dojo.dnd.move");
dojo.require("dojox.gfx");
dojo.require("dojox.fx");
dojo.addOnLoad(
function () {
// create moveable objects
new dojo.dnd.move.parentConstrainedMoveable("red", {area: "padding", within: true});
new dojo.dnd.move.parentConstrainedMoveable("blue", {area: "padding", within: true});
dojox.fx.slideBy({
node:"blue",
duration: 1,
top: 0,
left:145
}).play();
// surface for drawing
var board = dojo.byId("board");
var surface = dojox.gfx.createSurface(board, board.offsetWidth, board.offsetHeight);
var red = dojo.byId("red");
var blue = dojo.byId("blue");
var line = { x1: red.offsetLeft + red.offsetWidth,
y1: red.offsetTop + red.offsetHeight / 2,
x2: blue.offsetLeft,
y2: blue.offsetTop + blue.offsetHeight / 2 };
surface.createLine(line).setFill([255, 0, 0, 0.5]).setStroke({color: "red", width: 1});
}
);
-->
</script>
</head>
<body style="font-size: 12px;">
<h1>A Simple Example</h1>
<div id="board">
<div id="red">
RED
</div>
<div id="blue">
BLUE
</div>
</div>
</body> |
Partager