Skip to content

Instantly share code, notes, and snippets.

@Scordavis
Created December 10, 2017 09:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Scordavis/6a47cb80b30d248e49622b3a594ef743 to your computer and use it in GitHub Desktop.
Save Scordavis/6a47cb80b30d248e49622b3a594ef743 to your computer and use it in GitHub Desktop.
Переключение вкладки tab в Bootstrap при переходе с внешней ссылки (другой страницы). Switch tab on Bootstrap tabs by clicking on externa
// Javascript to enable link to tab
var url = document.location.toString();
if (url.match('#')) {
$('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
}
// Change hash for page-reload
$('.nav-tabs a').on('shown.bs.tab', function (e) {
window.location.hash = e.target.hash;
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment