Skip to content

Instantly share code, notes, and snippets.

@markrickert
Created September 14, 2011 15:01
Show Gist options
  • Save markrickert/1216804 to your computer and use it in GitHub Desktop.
Save markrickert/1216804 to your computer and use it in GitHub Desktop.
There Can Be Only One...
function there_can_be_only_one_highlander(the_one) {
var state_speed = 500,
immortals = ['#welcome-box', '#guest-box', '#login-box', '#register-box'],
to_kill = [],
key = null;
for (key in immortals) {
if (immortals[key] !== the_one) {
if (typeof immortals[key] === 'string') {
to_kill.push(immortals[key]);
}
}
}
jQuery(to_kill.join(',')).fadeOut(state_speed);
setTimeout(function() {jQuery(the_one).slideDown(state_speed);}, state_speed);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment