Created
February 23, 2016 01:35
-
-
Save Azerothian/5ae38ad8f753c2020049 to your computer and use it in GitHub Desktop.
Even in the world of jQuery... promises rain supreme.. even if its a bastardized.
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
$(".feature-tab-header").on("click", function() { | |
var targetTab = "." + $(this).attr("id"); | |
var targetHeader = this; | |
var promises = [ | |
$(".feature-tab.active").removeClass("active").promise(), | |
$(".feature-tab-header").removeClass("active").promise() | |
]; | |
return $.when(promises).done(function() { | |
$(targetHeader).addClass("active"); | |
$(targetTab).addClass("active"); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment