Created
May 31, 2016 19:32
-
-
Save arodu/b1b654b3bd81261392a4414ee86826de to your computer and use it in GitHub Desktop.
Javascript to enable link to tab
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
| // 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