Project

General

Profile

1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
	<meta charset="utf-8">
5
	<title>jQuery UI Effects - Effect demo</title>
6
	<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
7
	<script src="../../jquery-1.4.3.js"></script>
8
	<script src="../../ui/jquery.effects.core.js"></script>
9
	<script src="../../ui/jquery.effects.blind.js"></script>
10
	<script src="../../ui/jquery.effects.bounce.js"></script>
11
	<script src="../../ui/jquery.effects.clip.js"></script>
12
	<script src="../../ui/jquery.effects.drop.js"></script>
13
	<script src="../../ui/jquery.effects.explode.js"></script>
14
	<script src="../../ui/jquery.effects.fade.js"></script>
15
	<script src="../../ui/jquery.effects.fold.js"></script>
16
	<script src="../../ui/jquery.effects.highlight.js"></script>
17
	<script src="../../ui/jquery.effects.pulsate.js"></script>
18
	<script src="../../ui/jquery.effects.scale.js"></script>
19
	<script src="../../ui/jquery.effects.shake.js"></script>
20
	<script src="../../ui/jquery.effects.slide.js"></script>
21
	<script src="../../ui/jquery.effects.transfer.js"></script>
22
	<link rel="stylesheet" href="../demos.css">
23
	<style>
24
		.toggler { width: 500px; height: 200px; position: relative; }
25
		#button { padding: .5em 1em; text-decoration: none; }
26
		#effect { width: 240px; height: 135px; padding: 0.4em; position: relative; }
27
		#effect h3 { margin: 0; padding: 0.4em; text-align: center; }
28
		.ui-effects-transfer { border: 2px dotted gray; } 
29
	</style>
30
	<script>
31
	$(function() {
32
		// run the currently selected effect
33
		function runEffect() {
34
			// get effect type from 
35
			var selectedEffect = $( "#effectTypes" ).val();
36
			
37
			// most effect types need no options passed by default
38
			var options = {};
39
			// some effects have required parameters
40
			if ( selectedEffect === "scale" ) {
41
				options = { percent: 0 };
42
			} else if ( selectedEffect === "transfer" ) {
43
				options = { to: "#button", className: "ui-effects-transfer" };
44
			} else if ( selectedEffect === "size" ) {
45
				options = { to: { width: 200, height: 60 } };
46
			}
47

    
48
			// run the effect
49
			$( "#effect" ).effect( selectedEffect, options, 500, callback );
50
		};
51

    
52
		// callback function to bring a hidden box back
53
		function callback() {
54
			setTimeout(function() {
55
				$( "#effect" ).removeAttr( "style" ).hide().fadeIn();
56
			}, 1000 );
57
		};
58

    
59
		// set effect from select menu value
60
		$( "#button" ).click(function() {
61
			runEffect();
62
			return false;
63
		});
64
	});
65
	</script>
66
</head>
67
<body>
68

    
69
<div class="demo">
70

    
71
<div class="toggler">
72
	<div id="effect" class="ui-widget-content ui-corner-all">
73
		<h3 class="ui-widget-header ui-corner-all">Effect</h3>
74
		<p>
75
			Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. Nulla lorem metus, adipiscing ut, luctus sed, hendrerit vitae, mi.
76
		</p>
77
	</div>
78
</div>
79

    
80
<select name="effects" id="effectTypes">
81
	<option value="blind">Blind</option>
82
	<option value="bounce">Bounce</option>
83
	<option value="clip">Clip</option>
84
	<option value="drop">Drop</option>
85
	<option value="explode">Explode</option>
86
	<option value="fade">Fade</option>
87
	<option value="fold">Fold</option>
88
	<option value="highlight">Highlight</option>
89
	<option value="puff">Puff</option>
90
	<option value="pulsate">Pulsate</option>
91
	<option value="scale">Scale</option>
92
	<option value="shake">Shake</option>
93
	<option value="size">Size</option>
94
	<option value="slide">Slide</option>
95
	<option value="transfer">Transfer</option>
96
</select>
97

    
98
<a href="#" id="button" class="ui-state-default ui-corner-all">Run Effect</a>
99

    
100
</div><!-- End demo -->
101

    
102

    
103

    
104
<div class="demo-description">
105
<p>Click the button above to show the effect.</p>
106
</div><!-- End demo-description -->
107

    
108
</body>
109
</html>
(1-1/3)