2011-06-14 20:11:43 +00:00
|
|
|
<!doctype html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<title>jQuery UI Effects Test Suite</title>
|
2012-05-15 16:52:18 +00:00
|
|
|
<link rel="stylesheet" href="effects.css">
|
2015-09-30 07:49:13 +00:00
|
|
|
<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">
|
2011-06-14 20:11:43 +00:00
|
|
|
var test = $( "#testBox" ),
|
|
|
|
opts = $( ".arg" ),
|
|
|
|
optsRev = $( opts.get().reverse() ),
|
|
|
|
doer = $( "#doAnim" ),
|
|
|
|
current = $( "#current" ),
|
|
|
|
total = 1;
|
|
|
|
|
|
|
|
opts.each(function() {
|
|
|
|
total *= this.options.length;
|
|
|
|
});
|
|
|
|
|
2015-05-14 02:02:48 +00:00
|
|
|
opts.on( "change", doAnim );
|
|
|
|
doer.on( "click", doAnim );
|
|
|
|
$( "#cyclePrev" ).on( "click", function() {
|
2011-06-14 20:11:43 +00:00
|
|
|
cycle( -1 );
|
|
|
|
});
|
2015-05-14 02:02:48 +00:00
|
|
|
$( "#cycleNext" ).on( "click", function() {
|
2011-06-14 20:11:43 +00:00
|
|
|
cycle( 1 );
|
|
|
|
});
|
|
|
|
|
|
|
|
function cycle( direction ) {
|
|
|
|
optsRev.each(function() {
|
|
|
|
var cur = this.selectedIndex,
|
|
|
|
next = cur + direction,
|
2014-08-28 13:04:20 +00:00
|
|
|
len = this.options.length,
|
|
|
|
newIndex = ( next + len ) % len;
|
2012-04-23 17:07:03 +00:00
|
|
|
|
2014-08-28 13:04:20 +00:00
|
|
|
this.selectedIndex = newIndex;
|
2012-04-23 17:07:03 +00:00
|
|
|
|
2014-08-28 13:04:20 +00:00
|
|
|
if ( newIndex === next ) {
|
|
|
|
return false;
|
|
|
|
}
|
2011-06-14 20:11:43 +00:00
|
|
|
});
|
|
|
|
doAnim();
|
|
|
|
}
|
|
|
|
|
|
|
|
function doAnim() {
|
|
|
|
var cur = 0;
|
|
|
|
opts.each(function() {
|
2014-08-28 13:04:20 +00:00
|
|
|
cur *= this.options.length;
|
2011-06-14 20:11:43 +00:00
|
|
|
cur += this.selectedIndex;
|
|
|
|
});
|
|
|
|
cur++;
|
|
|
|
current.text( "Configuration: " + cur + " of " + total );
|
2014-08-28 13:04:20 +00:00
|
|
|
run.apply( test, opts.map(function() {
|
|
|
|
return $( this ).val();
|
|
|
|
}).get() );
|
2011-06-14 20:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function run( position, v, h, vo, ho ) {
|
|
|
|
var el = this,
|
2014-08-28 13:04:20 +00:00
|
|
|
style = el[ 0 ].style,
|
2011-06-14 20:11:43 +00:00
|
|
|
effect = {
|
|
|
|
effect: "scale",
|
|
|
|
mode: "effect",
|
|
|
|
percent: 200,
|
|
|
|
origin: [ vo, ho ],
|
|
|
|
duration: 500
|
|
|
|
};
|
2014-08-28 13:04:20 +00:00
|
|
|
|
|
|
|
el.stop( true, true );
|
|
|
|
|
2011-06-14 20:11:43 +00:00
|
|
|
if ( typeof style === "object" ) {
|
|
|
|
style.cssText = "";
|
|
|
|
} else {
|
2014-08-28 13:04:20 +00:00
|
|
|
el[ 0 ].style = "";
|
2011-06-14 20:11:43 +00:00
|
|
|
}
|
2014-08-28 13:04:20 +00:00
|
|
|
|
2011-06-14 20:11:43 +00:00
|
|
|
el.css( "position", position )
|
|
|
|
.css( h, 5 )
|
|
|
|
.css( v, 5 )
|
|
|
|
.delay( 100 )
|
|
|
|
.effect( effect );
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
2014-08-28 13:04:20 +00:00
|
|
|
|
2011-06-14 20:11:43 +00:00
|
|
|
<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>
|
2023-03-28 22:18:07 +00:00
|
|
|
</label><br>
|
2011-06-14 20:11:43 +00:00
|
|
|
<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>
|
2014-08-28 13:04:20 +00:00
|
|
|
|
2013-01-17 06:28:41 +00:00
|
|
|
</body>
|
2014-08-28 13:04:20 +00:00
|
|
|
</html>
|