Debian Codegraph @

dojox/fx/tests/test_sizeTo.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
3 <html>
4 <head>
5 <title>dojox.fx.sizeTo | experimental fx add-ons for the Dojo Toolkit</title>
6
7 <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug:true, parseOnLoad: true" ></script>
8 <style type="text/css">
9 @import "../../../dojo/resources/dojo.css";
10 @import "../../../dijit/themes/dijit.css";
11 @import "../../../dijit/themes/tundra/tundra.css";
12 @import "../../../dijit/tests/css/dijitTests.css";
13 .testBox {
14 position:absolute;
15 top:0; left:0;
16 width:50px;
17 height:50px;
18 background:#ededed;
19 border:1px solid #b7b7b7;
20 -moz-border-radius:6pt;
21 -webkit-border-radius:5pt;
22 overflow:hidden;
23 }
24 </style>
25 <script type="text/javascript">
26
27 dojo.require("dojox.fx.ext-dojo.NodeList");
28
29 var test1 = function(e){
30 // this is our click test,
31 dojox.fx.sizeTo({
32 node: e.target,
33 width: 120,
34 height:120,
35 duration:250
36 }).play(5);
37 };
38
39 var testundo = function(e){
40 dojox.fx.sizeTo({
41 node: e.target,
42 width:50,
43 height:50,
44 duration:320
45 }).play(5);
46
47 };
48
49 var test2 = function(e){
50 dojox.fx.sizeTo({
51 node: e.target,
52 width: 120,
53 height:120,
54 duration:120,
55 method:"combine"
56 }).play(5);
57 };
58
59 var noIdTest = function(){
60 var myNode = dojo.query(".noIdHere")[0]; // first one wins
61 if(myNode){
62 // mmm, fake events (all we're using is the target anyway ... )
63 (!dojo.hasClass(myNode,"testRun") ? test2 : testundo)({ target: myNode });
64 dojo.toggleClass(myNode,"testRun");
65 }
66 };
67
68 var resizeTest = function(e){
69
70 // this is our click test,
71 var animation = dojox.fx.sizeTo({
72 node: e.target,
73 width: 30,
74 height:30,
75 duration:1250,
76 method:"combine"
77 });
78
79 dojo.style(e.target, {
80 width:"500px",
81 top:0, left:0,
82 height:"500px"
83 });
84
85 setTimeout(dojo.hitch(animation, "play"), 1250);
86 };
87
88 var init = function(){
89
90 // lets setup out connections, etc ...
91 dojo.connect(dojo.byId("sizer1"),"onmousedown","test1");
92 dojo.connect(dojo.byId("sizer1"),"onmouseup","testundo"); // generic resest
93
94 // did you know dojo normalizes onmouseenter onmouseleave!?!? neat. ie got _one_ thing right.
95 dojo.connect(dojo.byId("sizer2"),"onmouseenter","test2");
96 dojo.connect(dojo.byId("sizer2"),"onmouseout","testundo");
97
98 dojo.connect(dojo.byId("testNodeCache"), "onclick", "resizeTest");
99
100 // example using dojo.query to get a couple of nodes and roll into one anim
101 var hasRun = false;
102 dojo.connect(dojo.byId("sizer3"),"onclick",function(e){
103 var _anims = [];
104 dojo.query(".testBox").forEach(function(n){
105 _anims.push(
106 dojox.fx.sizeTo({ node: n,
107 width: ( hasRun ? "50" : "150"),
108 height: ( hasRun ? "50" : "150"),
109 method:"chain",
110 duration:720
111 })
112 );
113 });
114 hasRun=!hasRun;
115 var anim = dojo.fx.combine(_anims);
116 anim.play();
117 });
118 };
119 dojo.addOnLoad(init);
120
121 </script>
122 </head>
123 <body class="tundra">
124 <h1 class="testTitle">dojox.fx.sizeTo test</h1>
125
126 <p>quick sizeTo API overview:</p>
127
128 <pre>
129 dojox.fx.sizeTo({
130 // basic requirements:
131 node: "aDomNodeId", // or a domNode reference
132 width: 200, // measured in px
133 height: 200, // measured in px
134 method: "chain" // is default, or "combine"
135 });
136 </pre>
137 <p>
138 little test blocks (works in FF/win/mac + ie6) <a href="javascript:void(0)" onClick="dojo.query('.testBox').sizeTo({ width: 200, height: 200, duration:400 }).play()">dojo.query() test</a>
139 </p>
140
141 <div style="position:relative; height:60px; width:600px; margin:0 auto;">
142 <div id="sizer1" class="testBox">
143 mouse down / mouse up
144 </div>
145 <div id="sizer2" class="testBox" style="left:60px;" >
146 hover / exit
147 </div>
148 <div class="testBox noIdHere" style="left:120px; ">
149 <a href="javascript:noIdTest()">noIdTest()</a>
150 </div>
151 <div class="testBox" id="sizer3" style="left:180px;">
152 all of em'
153 </div>
154 </div>
155 <br style="clear:both;">
156
157 (click the box labeled "all of em'" again to reset all nodes)
158
159 HTML AFTER
160 <br>
161
162 <div style="position:relative; height:110px; width:600px; margin:0 auto;">
163 <div id="testNodeCache" class="testBox" style="top: 0px; left: 0px; z-index: 1; height:90px; width:90px; margin:0 auto; background-color: black; color:#fff">This box moves when clicked to test parameter caching
164 </div>
165 </div>
166
167 <p>That's all, Folks!</p>
168
169 </body>
170 </html>