-
-
Save brandonc/1248567 to your computer and use it in GitHub Desktop.
Ugly Nested Conditions
This file contains 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
methodShow = (quick ? 'show' : 'slidedown'); | |
methodHide = (quick ? 'hide' : 'slideUp'); | |
if (!$desc.is(':visible')) { | |
$desc[methodShow](); | |
} else { | |
$desc[methodHide[(); | |
} |
This file contains 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
$desc.has(':visible')(quick ? 'hide' : 'slideUp'); | |
$desc.has(':hidden')(quick ? 'show' : 'slidedown'); |
This file contains 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
if (!$desc.is(':visible')) { | |
if(quick) | |
$desc.show(); | |
else | |
$desc.slideDown(); | |
} else { | |
if(quick) | |
$desc.hide(); | |
else | |
$desc.slideUp(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$desc.has(':visible')(quick ? 'hide' : 'slideUp');
$desc.has(':hidden')(quick ? 'show' : 'slidedown');