[766] | 1 | |
---|
| 2 | <ul class="UIAPIPlugin-toc"> |
---|
| 3 | <li><a href="toggle.html#overview">Overview</a></li> |
---|
| 4 | <li><a href="toggle.html#options">Arguments</a></li> |
---|
| 5 | </ul> |
---|
| 6 | <div class="UIAPIPlugin"> |
---|
| 7 | <h1>jQuery UI toggle</h1> |
---|
| 8 | <div id="overview"> |
---|
| 9 | <h2 class="top-header">Overview</h2> |
---|
| 10 | <div id="overview-main"> |
---|
| 11 | <div class="editsection" style="float:right;margin-left:5px;">[<a href="http://docs.jquery.com/action/edit/UI/Effects/toggle?section=1" title="Edit section: toggle( effect, [options], [speed], [callback] )">edit</a>]</div><a name="toggle.28_effect.2C_.5Boptions.5D.2C_.5Bspeed.5D.2C_.5Bcallback.5D_.29"></a><h3>toggle( effect, <span class="optional">[</span>options<span class="optional">]</span>, <span class="optional">[</span>speed<span class="optional">]</span>, <span class="optional">[</span>callback<span class="optional">]</span> )</h3> |
---|
| 12 | <p>The enhanced toggle method optionally accepts jQuery UI advanced effects.</p> |
---|
| 13 | <p>Uses a specific effect on an element to toggle the element if the first argument is an effect string.</p> |
---|
| 14 | </div> |
---|
| 15 | <div id="overview-dependencies"> |
---|
| 16 | <h3>Dependencies</h3> |
---|
| 17 | <ul> |
---|
| 18 | <li>Effects Core</li> |
---|
| 19 | </ul> |
---|
| 20 | </div> |
---|
| 21 | <div id="overview-example"> |
---|
| 22 | <h3>Example</h3> |
---|
| 23 | <div id="overview-example" class="example"> |
---|
| 24 | <ul><li><a href="toggle.html#demo"><span>Demo</span></a></li><li><a href="toggle.html#source"><span>View Source</span></a></li></ul> |
---|
| 25 | <p><div id="demo" class="tabs-container" rel="170"> |
---|
| 26 | Apply the effect slide if you click on the p to toggle a div.<br /> |
---|
| 27 | </p> |
---|
| 28 | <pre>$("p").<a href="http://docs.jquery.com/Events/click" title="Events/click">click</a>(function () { |
---|
| 29 | $("div").<strong class="selflink">toggle</strong>("slide", {}, 1000); |
---|
| 30 | }); |
---|
| 31 | </pre> |
---|
| 32 | <p></div><div id="source" class="tabs-container"> |
---|
| 33 | </p> |
---|
| 34 | <pre><!DOCTYPE html> |
---|
| 35 | <html> |
---|
| 36 | <head> |
---|
| 37 | <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> |
---|
| 38 | <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> |
---|
| 39 | <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> |
---|
| 40 | <script src="http://ui.jquery.com/latest/ui/effects.core.js"></script> |
---|
| 41 | <script src="http://ui.jquery.com/latest/ui/effects.slide.js"></script> |
---|
| 42 | <style type="text/css"> |
---|
| 43 | div { display: none; margin: 0px; width: 100px; height: 80px; background: blue; position: relative; } |
---|
| 44 | </style> |
---|
| 45 | <script> |
---|
| 46 | $(document).ready(function() { |
---|
| 47 | $("p").<a href="http://docs.jquery.com/Events/click" title="Events/click">click</a>(function () { |
---|
| 48 | $("div").<strong class="selflink">toggle</strong>("slide", {}, 1000); |
---|
| 49 | }); |
---|
| 50 | }); |
---|
| 51 | </script> |
---|
| 52 | </head> |
---|
| 53 | <body style="font-size:62.5%;"> |
---|
| 54 | |
---|
| 55 | <p>Click me</p><div></div> |
---|
| 56 | |
---|
| 57 | </body> |
---|
| 58 | </html> |
---|
| 59 | </pre> |
---|
| 60 | <p></div> |
---|
| 61 | </p><p></div> |
---|
| 62 | </div> |
---|
| 63 | </div> |
---|
| 64 | <div id="options"> |
---|
| 65 | <h2 class="top-header">Arguments</h2> |
---|
| 66 | <ul class="options-list"> |
---|
| 67 | |
---|
| 68 | <li class="option" id="option-effect"> |
---|
| 69 | <div class="option-header"> |
---|
| 70 | <h3 class="option-name"><a href="toggle.html#option-effect">effect</a></h3> |
---|
| 71 | <dl> |
---|
| 72 | <dt class="option-type-label">Type:</dt> |
---|
| 73 | <dd class="option-type">String</dd> |
---|
| 74 | |
---|
| 75 | </dl> |
---|
| 76 | </div> |
---|
| 77 | <div class="option-description"> |
---|
| 78 | <p>The effect to be used. Possible values: 'blind', 'clip', 'drop', 'explode', 'fold', 'puff', 'slide', 'scale', 'size', 'pulsate'.</p> |
---|
| 79 | </div> |
---|
| 80 | </li> |
---|
| 81 | |
---|
| 82 | |
---|
| 83 | <li class="option" id="option-options"> |
---|
| 84 | <div class="option-header"> |
---|
| 85 | <h3 class="option-name"><a href="toggle.html#option-options">options</a></h3> |
---|
| 86 | <dl> |
---|
| 87 | <dt class="option-type-label">Type:</dt> |
---|
| 88 | <dd class="option-type">Hash</dd> |
---|
| 89 | |
---|
| 90 | <dt class="option-optional-label">Optional</dt> |
---|
| 91 | |
---|
| 92 | </dl> |
---|
| 93 | </div> |
---|
| 94 | <div class="option-description"> |
---|
| 95 | <p>A object/hash including specific options for the effect.</p> |
---|
| 96 | </div> |
---|
| 97 | </li> |
---|
| 98 | |
---|
| 99 | |
---|
| 100 | <li class="option" id="option-speed"> |
---|
| 101 | <div class="option-header"> |
---|
| 102 | <h3 class="option-name"><a href="toggle.html#option-speed">speed</a></h3> |
---|
| 103 | <dl> |
---|
| 104 | <dt class="option-type-label">Type:</dt> |
---|
| 105 | <dd class="option-type">String, Number</dd> |
---|
| 106 | |
---|
| 107 | <dt class="option-optional-label">Optional</dt> |
---|
| 108 | |
---|
| 109 | </dl> |
---|
| 110 | </div> |
---|
| 111 | <div class="option-description"> |
---|
| 112 | <p>A string representing one of the predefined speeds ("slow" or "fast") or the number of milliseconds to run the animation (e.g. 1000).</p> |
---|
| 113 | </div> |
---|
| 114 | </li> |
---|
| 115 | |
---|
| 116 | |
---|
| 117 | <li class="option" id="option-callback"> |
---|
| 118 | <div class="option-header"> |
---|
| 119 | <h3 class="option-name"><a href="toggle.html#option-callback">callback</a></h3> |
---|
| 120 | <dl> |
---|
| 121 | <dt class="option-type-label">Type:</dt> |
---|
| 122 | <dd class="option-type">Function</dd> |
---|
| 123 | |
---|
| 124 | <dt class="option-optional-label">Optional</dt> |
---|
| 125 | |
---|
| 126 | </dl> |
---|
| 127 | </div> |
---|
| 128 | <div class="option-description"> |
---|
| 129 | <p>A function that is called after the effect is completed.</p> |
---|
| 130 | </div> |
---|
| 131 | </li> |
---|
| 132 | |
---|
| 133 | </ul> |
---|
| 134 | </div> |
---|
| 135 | </div> |
---|
| 136 | |
---|
| 137 | </p><!-- |
---|
| 138 | Pre-expand include size: 6350 bytes |
---|
| 139 | Post-expand include size: 8665 bytes |
---|
| 140 | Template argument size: 5445 bytes |
---|
| 141 | Maximum: 2097152 bytes |
---|
| 142 | --> |
---|
| 143 | |
---|
| 144 | <!-- Saved in parser cache with key jqdocs_docs:pcache:idhash:2615-1!1!0!!en!2 and timestamp 20110815115553 --> |
---|