|
1 <!DOCTYPE html> |
|
2 <html lang="en"> |
|
3 <head> |
|
4 <meta charset="UTF-8" /> |
|
5 <title>jQuery UI Effects - Hide Demo</title> |
|
6 <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" /> |
|
7 <script type="text/javascript" src="../../jquery-1.4.2.js"></script> |
|
8 <script type="text/javascript" src="../../ui/jquery.effects.core.js"></script> |
|
9 <script type="text/javascript" src="../../ui/jquery.effects.blind.js"></script> |
|
10 <script type="text/javascript" src="../../ui/jquery.effects.bounce.js"></script> |
|
11 <script type="text/javascript" src="../../ui/jquery.effects.clip.js"></script> |
|
12 <script type="text/javascript" src="../../ui/jquery.effects.drop.js"></script> |
|
13 <script type="text/javascript" src="../../ui/jquery.effects.explode.js"></script> |
|
14 <script type="text/javascript" src="../../ui/jquery.effects.fold.js"></script> |
|
15 <script type="text/javascript" src="../../ui/jquery.effects.highlight.js"></script> |
|
16 <script type="text/javascript" src="../../ui/jquery.effects.pulsate.js"></script> |
|
17 <script type="text/javascript" src="../../ui/jquery.effects.scale.js"></script> |
|
18 <script type="text/javascript" src="../../ui/jquery.effects.shake.js"></script> |
|
19 <script type="text/javascript" src="../../ui/jquery.effects.slide.js"></script> |
|
20 <script type="text/javascript" src="../../ui/jquery.effects.transfer.js"></script> |
|
21 <link type="text/css" href="../demos.css" rel="stylesheet" /> |
|
22 <style type="text/css"> |
|
23 .toggler { width: 500px; height: 200px; } |
|
24 #button { padding: .5em 1em; text-decoration: none; } |
|
25 #effect { width: 240px; height: 135px; padding: 0.4em; position: relative; } |
|
26 #effect h3 { margin: 0; padding: 0.4em; text-align: center; } |
|
27 .ui-effects-transfer { border: 2px dotted gray; } |
|
28 </style> |
|
29 <script type="text/javascript"> |
|
30 $(function() { |
|
31 |
|
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 //check if it's scale, transfer, or size - they need options explicitly set |
|
40 if(selectedEffect == 'scale'){ options = {percent: 0}; } |
|
41 else if(selectedEffect == 'transfer'){ options = { to: "#button", className: 'ui-effects-transfer' }; } |
|
42 else if(selectedEffect == 'size'){ options = { to: {width: 200,height: 60} }; } |
|
43 |
|
44 //run the effect |
|
45 $("#effect").hide(selectedEffect,options,500,callback); |
|
46 }; |
|
47 |
|
48 //callback function to bring a hidden box back |
|
49 function callback(){ |
|
50 setTimeout(function(){ |
|
51 $("#effect:hidden").removeAttr('style').hide().fadeIn(); |
|
52 }, 1000); |
|
53 }; |
|
54 |
|
55 //set effect from select menu value |
|
56 $("#button").click(function() { |
|
57 runEffect(); |
|
58 return false; |
|
59 }); |
|
60 |
|
61 }); |
|
62 </script> |
|
63 </head> |
|
64 <body> |
|
65 |
|
66 <div class="demo"> |
|
67 |
|
68 <div class="toggler"> |
|
69 <div id="effect" class="ui-widget-content ui-corner-all"> |
|
70 <h3 class="ui-widget-header ui-corner-all">Hide</h3> |
|
71 <p> |
|
72 Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. Nulla lorem metus, adipiscing ut, luctus sed, hendrerit vitae, mi. |
|
73 </p> |
|
74 </div> |
|
75 </div> |
|
76 |
|
77 <select name="effects" id="effectTypes"> |
|
78 <option value="blind">Blind</option> |
|
79 <option value="bounce">Bounce</option> |
|
80 <option value="clip">Clip</option> |
|
81 <option value="drop">Drop</option> |
|
82 <option value="explode">Explode</option> |
|
83 <option value="fold">Fold</option> |
|
84 <option value="highlight">Highlight</option> |
|
85 <option value="puff">Puff</option> |
|
86 <option value="pulsate">Pulsate</option> |
|
87 <option value="scale">Scale</option> |
|
88 <option value="shake">Shake</option> |
|
89 <option value="size">Size</option> |
|
90 <option value="slide">Slide</option> |
|
91 <option value="transfer">Transfer</option> |
|
92 </select> |
|
93 |
|
94 <a href="#" id="button" class="ui-state-default ui-corner-all">Run Effect</a> |
|
95 |
|
96 |
|
97 </div><!-- End demo --> |
|
98 |
|
99 <div class="demo-description"> |
|
100 |
|
101 <p>Click the button above to preview the effect.</p> |
|
102 |
|
103 </div><!-- End demo-description --> |
|
104 |
|
105 </body> |
|
106 </html> |