aboutsummaryrefslogtreecommitdiffstats
path: root/tests/visual/effects/scale.html
blob: 1d5a5bbfa9e7f06f650c43296d346b2fc3554d9b (plain)
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
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .
<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>jQuery UI Effects Test Suite</title>
	<link rel="stylesheet" href="effects.css">
	<style>
	#testArea {
		width: 200px;
		height: 200px;
		position: relative;
	}
	#testBox {
		width: 50px;
		height: 50px;
		background-color: #bada55;
		color: black;
		border: 10px solid #fff;
		margin: 10px;
		padding: 10px;
		position: absolute;
		left: 5px;
		top: 5px;
	}
	label {
		display: block;
	}
	#controls {
		position: absolute;
		z-index: 300;
		left: 50%;
		top: 50%;
		margin-left: -200px;
		width: 400px;
		opacity: 0.8;
	}
	</style>
	<script src="../../../external/requirejs/require.js"></script>
	<script src="../../../demos/bootstrap.js" data-modules="effect-scale" data-composite="true">
		var test = $( "#testBox" ),
			opts = $( ".arg" ),
			optsRev = $( opts.get().reverse() ),
			doer = $( "#doAnim" ),
			current = $( "#current" ),
			total = 1;

		opts.each(function() {
			total *= this.options.length;
		});

		opts.on( "change", doAnim );
		doer.on( "click", doAnim );
		$( "#cyclePrev" ).on( "click", function() {
			cycle( -1 );
		});
		$( "#cycleNext" ).on( "click", function() {
			cycle( 1 );
		});

		function cycle( direction ) {
			optsRev.each(function() {
				var cur = this.selectedIndex,
					next = cur + direction,
					len = this.options.length,
					newIndex = ( next + len ) % len;

				this.selectedIndex = newIndex;

				if ( newIndex === next ) {
					return false;
				}
			});
			doAnim();
		}

		function doAnim() {
			var cur = 0;
			opts.each(function() {
				cur *= this.options.length;
				cur += this.selectedIndex;
			});
			cur++;
			current.text( "Configuration: " + cur + " of " + total );
			run.apply( test, opts.map(function() {
				return $( this ).val();
			}).get() );
		}

		function run( position, v, h, vo, ho ) {
			var el = this,
				style = el[ 0 ].style,
				effect = {
					effect: "scale",
					mode: "effect",
					percent: 200,
					origin: [ vo, ho ],
					duration: 500
				};

			el.stop( true, true );

			if ( typeof style === "object" ) {
				style.cssText = "";
			} else {
				el[ 0 ].style = "";
			}

			el.css( "position", position )
				.css( h, 5 )
				.css( v, 5 )
				.delay( 100 )
				.effect( effect );
		}
	</script>
</head>
<body>

	<div id="testArea">
		<div id="testBox">
		</div>
	</div>
	<div id="controls">
		<label for="pos">Positioning
			<select id="pos" class="arg">
				<option value="absolute">absolute</option>
				<option value="relative">relative</option>
				<option value="fixed">fixed</option>
			</select>
		</label>
		<label for="vertPos">Vertical Positioning
			<select id="vertPos" class="arg">
				<option value="top">top</option>
				<option value="bottom">bottom</option>
			</select>
		</label>
		<label for="horizPos">Horizontal Positioning
			<select id="horizPos" class="arg">
				<option value="left">left</option>
				<option value="right">right</option>
			</select>
		</label>
		<label for="vertOrigin">Vertical Origin
			<select id="vertOrigin" class="arg">
				<option value="top">top</option>
				<option value="middle">middle</option>
				<option value="bottom">bottom</option>
			</select>
		</label>
		<label for="horizOrigin">Horizontal Origin
			<select id="horizOrigin" class="arg">
				<option value="left">left</option>
				<option value="center">center</option>
				<option value="right">right</option>
			</select>
		</label><br>
		<label id="current">jQuery UI Scale Animation Test</label>
		<button id="cyclePrev">Back</button>
		<button id="doAnim">Run Animation</button>
		<button id="cycleNext">Forward</button>
	</div>

</body>
</html>