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