Example Toggle
# jQuery UI Example - Toggle
Use custom effects to show or hide matched elements.
For more details on the `.toggle()` method, please see the API documentation [.toggle()](#).
## .toggle() Demo
Click the button to preview the effect.
jQuery UI Effects - .toggle() Demo .toggler { width: 500px; height: 200px; } #button { padding: .5em 1em; text-decoration: none; } #effect { position: relative; width: 240px; height: 135px; padding: 0.4em; } #effect h3 { margin: 0; padding: 0.4em; text-align: center; } $(function() { // Run the currently selected effect function runEffect() { // Get the selected effect type var selectedEffect = $( "#effectTypes" ).val(); // Most effects don't require options by default var options = {}; // Some effects have required parameters if ( selectedEffect === "scale" ) { options = { percent: 0 }; } else if ( selectedEffect === "size" ) { options = { to: { width: 200, height: 60 } }; } // Run the effect $( "#effect" ).toggle( selectedEffect, options, 500 ); }; // Set effect from select menu value $( "#button" ).click(function() { runEffect(); return false; }); }); Blind Effect Bounce Effect Clip Effect Drop Effect Explode Effect Fold Effect Highlight Effect Puff Effect Pulsate Effect Scale Effect Shake Effect Size Effect Slide Effect Run Effect
(#)
YouTip