1 |
<!doctype html> |
2 |
<html lang="en"> |
3 |
<head> |
4 |
<meta charset="utf-8"> |
5 |
<title>jQuery UI Effects - Show 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 { width: 500px; height: 200px; } |
23 |
#button { padding: .5em 1em; text-decoration: none; } |
24 |
#effect { width: 240px; height: 135px; padding: 0.4em; position: relative; } |
25 |
#effect h3 { margin: 0; padding: 0.4em; text-align: center; } |
26 |
</style> |
27 |
<script> |
28 |
$(function() { |
29 |
// run the currently selected effect |
30 |
function runEffect() { |
31 |
// get effect type from |
32 |
var selectedEffect = $( "#effectTypes" ).val(); |
33 |
|
34 |
// most effect types need no options passed by default |
35 |
var options = {}; |
36 |
// some effects have required parameters |
37 |
if ( selectedEffect === "scale" ) { |
38 |
options = { percent: 100 }; |
39 |
} else if ( selectedEffect === "size" ) { |
40 |
options = { to: { width: 280, height: 185 } }; |
41 |
} |
42 |
|
43 |
// run the effect |
44 |
$( "#effect" ).show( selectedEffect, options, 500, callback ); |
45 |
}; |
46 |
|
47 |
//callback function to bring a hidden box back |
48 |
function callback() { |
49 |
setTimeout(function() { |
50 |
$( "#effect:visible" ).removeAttr( "style" ).fadeOut(); |
51 |
}, 1000 ); |
52 |
}; |
53 |
|
54 |
// set effect from select menu value |
55 |
$( "#button" ).click(function() { |
56 |
runEffect(); |
57 |
return false; |
58 |
}); |
59 |
|
60 |
$( "#effect" ).hide(); |
61 |
}); |
62 |
</script> |
63 |
</head> |
64 |
<body> |
65 |
|
66 |
<div class="toggler"> |
67 |
<div id="effect" class="ui-widget-content ui-corner-all"> |
68 |
<h3 class="ui-widget-header ui-corner-all">Show</h3> |
69 |
<p> |
70 |
Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. Nulla lorem metus, adipiscing ut, luctus sed, hendrerit vitae, mi. |
71 |
</p> |
72 |
</div> |
73 |
</div> |
74 |
|
75 |
<select name="effects" id="effectTypes"> |
76 |
<option value="blind">Blind</option> |
77 |
<option value="bounce">Bounce</option> |
78 |
<option value="clip">Clip</option> |
79 |
<option value="drop">Drop</option> |
80 |
<option value="explode">Explode</option> |
81 |
<option value="fold">Fold</option> |
82 |
<option value="highlight">Highlight</option> |
83 |
<option value="puff">Puff</option> |
84 |
<option value="pulsate">Pulsate</option> |
85 |
<option value="scale">Scale</option> |
86 |
<option value="shake">Shake</option> |
87 |
<option value="size">Size</option> |
88 |
<option value="slide">Slide</option> |
89 |
</select> |
90 |
|
91 |
<a href="#" id="button" class="ui-state-default ui-corner-all">Run Effect</a> |
92 |
|
93 |
<div class="demo-description"> |
94 |
<p>Click the button above to preview the effect.</p> |
95 |
</div> |
96 |
</body> |
97 |
</html> |