Skip to content

Instantly share code, notes, and snippets.

@omerida
Created March 29, 2012 13:58
Show Gist options
  • Select an option

  • Save omerida/2237704 to your computer and use it in GitHub Desktop.

Select an option

Save omerida/2237704 to your computer and use it in GitHub Desktop.
jquery: Toggle another element without .toggle
// something we can click
$button = $('.some-button');
// the container we want to show and hide
$dialog = $('#dialog');
// bind click to open & close
$button.click(function(event) {
if ($dialog.is(':visible')) {
// could use another effect or do any shutdown work here
$dialog.hide();
} else {
// could use another effect or do any prep work here
$dialog.show();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment