bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Unable to get fade to work for tabbable nav

Open ghost opened this issue 14 years ago • 9 comments

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 :)

ghost avatar May 04 '12 13:05 ghost

Please close this issue. I'm 90% sure I have found the solution.

ghost avatar May 04 '12 13:05 ghost

Hey, I'd be interested in knowing the solution :)

trumbitta avatar May 04 '12 14:05 trumbitta

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

ghost avatar May 04 '12 14:05 ghost

Yup, didn't notice the fade-in was there from the start!

trumbitta avatar May 04 '12 14:05 trumbitta

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?

elflo avatar May 04 '12 15:05 elflo

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>

fernandoaleman avatar Apr 16 '13 17:04 fernandoaleman

I also wanted to mention that I am using jquery 1.9.1 in case that helps.

fernandoaleman avatar Apr 16 '13 22:04 fernandoaleman

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.

marcussjoholm avatar Apr 23 '13 07:04 marcussjoholm

@anderssonma That worked perfectly. Thank you!

fernandoaleman avatar Apr 25 '13 22:04 fernandoaleman