Debian Codegraph @

tests/visual/effects/scale.html

raw symbols SCIP
1 <!doctype html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <title>jQuery UI Effects Test Suite</title>
6 <link rel="stylesheet" href="effects.css">
7 <style>
8 #testArea {
9 width: 200px;
10 height: 200px;
11 position: relative;
12 }
13 #testBox {
14 width: 50px;
15 height: 50px;
16 background-color: #bada55;
17 color: black;
18 border: 10px solid #fff;
19 margin: 10px;
20 padding: 10px;
21 position: absolute;
22 left: 5px;
23 top: 5px;
24 }
25 label {
26 display: block;
27 }
28 #controls {
29 position: absolute;
30 z-index: 300;
31 left: 50%;
32 top: 50%;
33 margin-left: -200px;
34 width: 400px;
35 opacity: 0.8;
36 }
37 </style>
38 <script src="../../../external/requirejs/require.js"></script>
39 <script src="../../../demos/bootstrap.js" data-modules="effect-scale" data-composite="true">
40 var test = $( "#testBox" ),
41 opts = $( ".arg" ),
42 optsRev = $( opts.get().reverse() ),
43 doer = $( "#doAnim" ),
44 current = $( "#current" ),
45 total = 1;
46
47 opts.each(function() {
48 total *= this.options.length;
49 });
50
51 opts.on( "change", doAnim );
52 doer.on( "click", doAnim );
53 $( "#cyclePrev" ).on( "click", function() {
54 cycle( -1 );
55 });
56 $( "#cycleNext" ).on( "click", function() {
57 cycle( 1 );
58 });
59
60 function cycle( direction ) {
61 optsRev.each(function() {
62 var cur = this.selectedIndex,
63 next = cur + direction,
64 len = this.options.length,
65 newIndex = ( next + len ) % len;
66
67 this.selectedIndex = newIndex;
68
69 if ( newIndex === next ) {
70 return false;
71 }
72 });
73 doAnim();
74 }
75
76 function doAnim() {
77 var cur = 0;
78 opts.each(function() {
79 cur *= this.options.length;
80 cur += this.selectedIndex;
81 });
82 cur++;
83 current.text( "Configuration: " + cur + " of " + total );
84 run.apply( test, opts.map(function() {
85 return $( this ).val();
86 }).get() );
87 }
88
89 function run( position, v, h, vo, ho ) {
90 var el = this,
91 style = el[ 0 ].style,
92 effect = {
93 effect: "scale",
94 mode: "effect",
95 percent: 200,
96 origin: [ vo, ho ],
97 duration: 500
98 };
99
100 el.stop( true, true );
101
102 if ( typeof style === "object" ) {
103 style.cssText = "";
104 } else {
105 el[ 0 ].style = "";
106 }
107
108 el.css( "position", position )
109 .css( h, 5 )
110 .css( v, 5 )
111 .delay( 100 )
112 .effect( effect );
113 }
114 </script>
115 </head>
116 <body>
117
118 <div id="testArea">
119 <div id="testBox">
120 </div>
121 </div>
122 <div id="controls">
123 <label for="pos">Positioning
124 <select id="pos" class="arg">
125 <option value="absolute">absolute</option>
126 <option value="relative">relative</option>
127 <option value="fixed">fixed</option>
128 </select>
129 </label>
130 <label for="vertPos">Vertical Positioning
131 <select id="vertPos" class="arg">
132 <option value="top">top</option>
133 <option value="bottom">bottom</option>
134 </select>
135 </label>
136 <label for="horizPos">Horizontal Positioning
137 <select id="horizPos" class="arg">
138 <option value="left">left</option>
139 <option value="right">right</option>
140 </select>
141 </label>
142 <label for="vertOrigin">Vertical Origin
143 <select id="vertOrigin" class="arg">
144 <option value="top">top</option>
145 <option value="middle">middle</option>
146 <option value="bottom">bottom</option>
147 </select>
148 </label>
149 <label for="horizOrigin">Horizontal Origin
150 <select id="horizOrigin" class="arg">
151 <option value="left">left</option>
152 <option value="center">center</option>
153 <option value="right">right</option>
154 </select>
155 </label><br>
156 <label id="current">jQuery UI Scale Animation Test</label>
157 <button id="cyclePrev">Back</button>
158 <button id="doAnim">Run Animation</button>
159 <button id="cycleNext">Forward</button>
160 </div>
161
162 </body>
163 </html>