Started

Selectors

Utilities

Animation

AJAX

CSS

Event

Manipulation

Cookie

String

Attributes

Data

Storage

Miscellaneous

$toggle

Display or hide targeted element.
$toggle( element, duration, callback )
  1. element [object]
    The target element.
  2. duration (optional) [number]
    The duration of toggle animation in milliseconds.
  3. callback (optional) [function]
    The callback function will be fired after the toggle animation is completed.

Notes

This most common function to display or hide element, useful for menu.

Example

HTML code
<div id="box1" class="box">This is a box</div>
<button onclick="start_toggle()">toggle box display</button>
CSS code
.box {
	width: 200px;
	height: 60px;
	font-size: 12px;
	background: #5599bb;
	padding: 10px;
	margin: 10px 0;
}
JavaScript code
function start_toggle()
{
	$toggle($("box1"), 500);
}
Demonstration
This is a box