Unable to get fade to work for tabbable nav
Hello,
I spent at least the last hour at work trying to get tabbable navs to work but did not succeed.
My markup is pretty much similar to:
div class="tab-content"
div class="tab-pane active" id="tab1"
I'm in Section 1.
/div
div class="tab-pane" id="tab2"
Howdy, I'm in Section 2.
/div
/div
Adding "fade" next to "tab-pane" did not help in the least. I have double checked the javascript files to be sure I have the necessary code to make it work. My goal is to make something very similar to what https://kippt.com/ have implemented. An apple.com style fade in.
p.s : figuring out makdown syntax on github right now. sorry :)
Please close this issue. I'm 90% sure I have found the solution.
Hey, I'd be interested in knowing the solution :)
Check this page http://twitter.github.com/bootstrap/javascript.html#tabs
My fault that I din't read carefully enough.. but going by my username. :)
On Fri, May 4, 2012 at 7:46 PM, William Ghelfi < [email protected]
wrote:
Hey, I'd be interested in knowing the solution :)
Reply to this email directly or view it on GitHub: https://github.com/twitter/bootstrap/issues/3357#issuecomment-5511313
Yup, didn't notice the fade-in was there from the start!
It looks like you now need to add the in class to your active .tab-pane
Example:
<div class="tab-pane fade in active">
this is your active tab content
</div>
<div class="tab-pane fade">
this is another tab content
</div>
Didn't find that explained in the documentation though?
I cannot seem to get the fade effect to work with my code, based on the documentation and the examples above. Can anyone help see what I am missing?
<ul id="myTab" class="nav nav-tabs">
<li>
<a href="#tab1" data-toggle="tab">Example #1</a>
</li>
<li>
<a href="#tab2" data-toggle="tab">Example #2</a>
</li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="tab1">
<p>Example #1</p>
</div>
<div class="tab-pane fade" id="tab2">
<p>Example #2</p>
</div>
</div>
<script>
$('#myTab a').click(function (e) {
e.preventDefault();
$(this).tab('show');
})
$('#myTab a:first').tab('show');
</script>
I also wanted to mention that I am using jquery 1.9.1 in case that helps.
I don't think you should use both the data-toggles and the js activations. Just get rid of your javascript and it should work really. Once I added "in" to one of my panes everything started working.
@anderssonma That worked perfectly. Thank you!