Skip to content

Instantly share code, notes, and snippets.

@MyCueCards
Last active February 13, 2019 15:08
Show Gist options
  • Save MyCueCards/d03a25245c8284f858b093e40d692eaa to your computer and use it in GitHub Desktop.
Save MyCueCards/d03a25245c8284f858b093e40d692eaa to your computer and use it in GitHub Desktop.
In Bootstrap, this looks for a string in the URL and actives the tabs for either English or Spanish without having to open a different window.
$(document).ready(function () {
if (window.location.href.indexOf("?lang=en") > -1) {
function doEnglish() {
$('#english').addClass('active');
$('#en').addClass('active');
$('#español').removeClass('active');
$('#es').removeClass('active');
}
setTimeout(doEnglish, 0);
} else {
function doSpanish() {
$('#español').addClass('active');
$('#es').addClass('active');
$('#english').removeClass('active');
$('#en').removeClass('active');
}
setTimeout(doSpanish, 0);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment