1 |
<!doctype html> |
2 |
<html lang="en"> |
3 |
<head> |
4 |
<meta charset="utf-8"> |
5 |
<title>jQuery UI Effects - Toggle Demo</title> |
6 |
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css"> |
7 |
<script src="../../jquery-1.9.1.js"></script> |
8 |
<script src="../../ui/jquery.ui.effect.js"></script> |
9 |
<script src="../../ui/jquery.ui.effect-blind.js"></script> |
10 |
<script src="../../ui/jquery.ui.effect-bounce.js"></script> |
11 |
<script src="../../ui/jquery.ui.effect-clip.js"></script> |
12 |
<script src="../../ui/jquery.ui.effect-drop.js"></script> |
13 |
<script src="../../ui/jquery.ui.effect-explode.js"></script> |
14 |
<script src="../../ui/jquery.ui.effect-fold.js"></script> |
15 |
<script src="../../ui/jquery.ui.effect-highlight.js"></script> |
16 |
<script src="../../ui/jquery.ui.effect-pulsate.js"></script> |
17 |
<script src="../../ui/jquery.ui.effect-scale.js"></script> |
18 |
<script src="../../ui/jquery.ui.effect-shake.js"></script> |
19 |
<script src="../../ui/jquery.ui.effect-slide.js"></script> |
20 |
<link rel="stylesheet" href="../demos.css"> |
21 |
<style> |
22 |
.toggler { |
23 |
width: 500px; |
24 |
height: 200px; |
25 |
} |
26 |
#button { |
27 |
padding: .5em 1em; |
28 |
text-decoration: none; |
29 |
} |
30 |
#effect { |
31 |
position: relative; |
32 |
width: 240px; |
33 |
height: 135px; |
34 |
padding: 0.4em; |
35 |
} |
36 |
#effect h3 { |
37 |
margin: 0; |
38 |
padding: 0.4em; |
39 |
text-align: center; |
40 |
} |
41 |
</style> |
42 |
<script> |
43 |
$(function() { |
44 |
// run the currently selected effect |
45 |
function runEffect() { |
46 |
// get effect type from |
47 |
var selectedEffect = $( "#effectTypes" ).val(); |
48 |
|
49 |
// most effect types need no options passed by default |
50 |
var options = {}; |
51 |
// some effects have required parameters |
52 |
if ( selectedEffect === "scale" ) { |
53 |
options = { percent: 0 }; |
54 |
} else if ( selectedEffect === "size" ) { |
55 |
options = { to: { width: 200, height: 60 } }; |
56 |
} |
57 |
|
58 |
// run the effect |
59 |
$( "#effect" ).toggle( selectedEffect, options, 500 ); |
60 |
}; |
61 |
|
62 |
// set effect from select menu value |
63 |
$( "#button" ).click(function() { |
64 |
runEffect(); |
65 |
return false; |
66 |
}); |
67 |
}); |
68 |
</script> |
69 |
</head> |
70 |
<body> |
71 |
|
72 |
<div class="toggler"> |
73 |
<div id="effect" class="ui-widget-content ui-corner-all"> |
74 |
<h3 class="ui-widget-header ui-corner-all">Toggle</h3> |
75 |
<p> |
76 |
Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. Nulla lorem metus, adipiscing ut, luctus sed, hendrerit vitae, mi. |
77 |
</p> |
78 |
</div> |
79 |
</div> |
80 |
|
81 |
<select name="effects" id="effectTypes"> |
82 |
<option value="blind">Blind</option> |
83 |
<option value="bounce">Bounce</option> |
84 |
<option value="clip">Clip</option> |
85 |
<option value="drop">Drop</option> |
86 |
<option value="explode">Explode</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 |
</select> |
96 |
|
97 |
<a href="#" id="button" class="ui-state-default ui-corner-all">Run Effect</a> |
98 |
|
99 |
<div class="demo-description"> |
100 |
<p>Click the button above to preview the effect.</p> |
101 |
</div> |
102 |
</body> |
103 |
</html> |