Last active
August 29, 2015 14:10
-
-
Save krishan/fba5b2654167d261f07b to your computer and use it in GitHub Desktop.
make first bootstrap tabs active by default in scrivito
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
| // make the first tab of each bootstrap tab panel active | |
| scrivito.on("content", function(content) { | |
| // explanation of find & addBack usage see: | |
| // http://stackoverflow.com/questions/2828019 | |
| $(content). | |
| find("[role=tabpanel]").addBack("[role=tabpanel]"). | |
| each(function(_, panel) { | |
| $(panel).find(".nav-tabs > *:first").addClass("active"); | |
| $(panel).find(".tab-content > *:first").addClass("active"); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
looks fine to me