|
1 | 1 | <!doctype html> |
2 | 2 | <html lang="en"> |
3 | 3 | <head> |
4 | | - <title>jQuery UI Effect Methods - Hide Demo</title> |
| 4 | + <title>jQuery UI Effects - Hide Demo</title> |
5 | 5 | <link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" /> |
6 | 6 | <script type="text/javascript" src="../../jquery-1.3.2.js"></script> |
7 | 7 | <script type="text/javascript" src="../../ui/effects.core.js"></script> |
| 8 | + <script type="text/javascript" src="../../ui/effects.blind.js"></script> |
8 | 9 | <script type="text/javascript" src="../../ui/effects.bounce.js"></script> |
| 10 | + <script type="text/javascript" src="../../ui/effects.clip.js"></script> |
| 11 | + <script type="text/javascript" src="../../ui/effects.drop.js"></script> |
| 12 | + <script type="text/javascript" src="../../ui/effects.explode.js"></script> |
| 13 | + <script type="text/javascript" src="../../ui/effects.fold.js"></script> |
| 14 | + <script type="text/javascript" src="../../ui/effects.highlight.js"></script> |
| 15 | + <script type="text/javascript" src="../../ui/effects.pulsate.js"></script> |
| 16 | + <script type="text/javascript" src="../../ui/effects.scale.js"></script> |
| 17 | + <script type="text/javascript" src="../../ui/effects.shake.js"></script> |
| 18 | + <script type="text/javascript" src="../../ui/effects.slide.js"></script> |
| 19 | + <script type="text/javascript" src="../../ui/effects.transfer.js"></script> |
9 | 20 | <link type="text/css" href="../demos.css" rel="stylesheet" /> |
10 | 21 | <style type="text/css"> |
11 | 22 | .toggler { width: 500px; height: 200px; } |
12 | 23 | #button { padding: .5em 1em; text-decoration: none; } |
13 | | - #hide { width: 240px; height: 135px; padding: 0.4em; } |
14 | | - #hide h3 { margin: 0; padding: 0.4em; text-align: center; } |
| 24 | + #effect { width: 240px; height: 135px; padding: 0.4em; position: relative; } |
| 25 | + #effect h3 { margin: 0; padding: 0.4em; text-align: center; } |
| 26 | + .ui-effects-transfer { border: 2px dotted gray; } |
15 | 27 | </style> |
16 | 28 | <script type="text/javascript"> |
17 | 29 | $(function() { |
| 30 | + |
| 31 | + //run the currently selected effect |
| 32 | + function runEffect(){ |
| 33 | + //get effect type from |
| 34 | + var selectedEffect = $('#effectTypes').val(); |
| 35 | + |
| 36 | + //most effect types need no options passed by default |
| 37 | + var options = {}; |
| 38 | + //check if it's scale, transfer, or size - they need options explicitly set |
| 39 | + if(selectedEffect == 'scale'){ options = {percent: 0}; } |
| 40 | + else if(selectedEffect == 'transfer'){ options = { to: "#button", className: 'ui-effects-transfer' }; } |
| 41 | + else if(selectedEffect == 'size'){ options = { to: {width: 200,height: 60} }; } |
| 42 | + |
| 43 | + //run the effect |
| 44 | + $("#effect").hide(selectedEffect,options,500,callback); |
| 45 | + }; |
| 46 | + |
| 47 | + //callback function to bring a hidden box back |
| 48 | + function callback(){ |
| 49 | + setTimeout(function(){ |
| 50 | + $("#effect:hidden").removeAttr('style').hide().fadeIn(); |
| 51 | + }, 1000); |
| 52 | + }; |
| 53 | + |
| 54 | + //set effect from select menu value |
18 | 55 | $("#button").click(function() { |
19 | | - $('#hide').hide("bounce"); |
| 56 | + runEffect(); |
20 | 57 | }); |
| 58 | + |
21 | 59 | }); |
22 | 60 | </script> |
23 | 61 | </head> |
|
26 | 64 | <div class="demo"> |
27 | 65 |
|
28 | 66 | <div class="toggler"> |
29 | | - <div id="hide" class="ui-widget-content ui-corner-all"> |
| 67 | + <div id="effect" class="ui-widget-content ui-corner-all"> |
30 | 68 | <h3 class="ui-widget-header ui-corner-all">Hide</h3> |
31 | 69 | <p> |
32 | 70 | Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. Nulla lorem metus, adipiscing ut, luctus sed, hendrerit vitae, mi. |
33 | 71 | </p> |
34 | 72 | </div> |
35 | 73 | </div> |
36 | | -<a href="#" id="button" class="ui-state-default ui-corner-all">Show Effect</a> |
| 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 | + <option value="transfer">Transfer</option> |
| 90 | +</select> |
| 91 | + |
| 92 | +<a href="#" id="button" class="ui-state-default ui-corner-all">Run Effect</a> |
| 93 | + |
37 | 94 |
|
38 | 95 | </div><!-- End demo --> |
39 | 96 |
|
|
0 commit comments