Created
March 29, 2012 13:58
-
-
Save omerida/2237704 to your computer and use it in GitHub Desktop.
jquery: Toggle another element without .toggle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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