7
|
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.10.2.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-fade.js"></script>
|
|
15 <script src="../../ui/jquery.ui.effect-fold.js"></script>
|
|
16 <script src="../../ui/jquery.ui.effect-highlight.js"></script>
|
|
17 <script src="../../ui/jquery.ui.effect-pulsate.js"></script>
|
|
18 <script src="../../ui/jquery.ui.effect-scale.js"></script>
|
|
19 <script src="../../ui/jquery.ui.effect-shake.js"></script>
|
|
20 <script src="../../ui/jquery.ui.effect-slide.js"></script>
|
|
21 <script src="../../ui/jquery.ui.effect-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="toggler">
|
|
70 <div id="effect" class="ui-widget-content ui-corner-all">
|
|
71 <h3 class="ui-widget-header ui-corner-all">Effect</h3>
|
|
72 <p>
|
|
73 Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. Nulla lorem metus, adipiscing ut, luctus sed, hendrerit vitae, mi.
|
|
74 </p>
|
|
75 </div>
|
|
76 </div>
|
|
77
|
|
78 <select name="effects" id="effectTypes">
|
|
79 <option value="blind">Blind</option>
|
|
80 <option value="bounce">Bounce</option>
|
|
81 <option value="clip">Clip</option>
|
|
82 <option value="drop">Drop</option>
|
|
83 <option value="explode">Explode</option>
|
|
84 <option value="fade">Fade</option>
|
|
85 <option value="fold">Fold</option>
|
|
86 <option value="highlight">Highlight</option>
|
|
87 <option value="puff">Puff</option>
|
|
88 <option value="pulsate">Pulsate</option>
|
|
89 <option value="scale">Scale</option>
|
|
90 <option value="shake">Shake</option>
|
|
91 <option value="size">Size</option>
|
|
92 <option value="slide">Slide</option>
|
|
93 <option value="transfer">Transfer</option>
|
|
94 </select>
|
|
95
|
|
96 <a href="#" id="button" class="ui-state-default ui-corner-all">Run Effect</a>
|
|
97
|
|
98 <div class="demo-description">
|
|
99 <p>Click the button above to show the effect.</p>
|
|
100 </div>
|
|
101 </body>
|
|
102 </html>
|