• No results found

Fade Effect

In document bootstrap_tutorial.pdf (Page 195-200)

To get a fade effect for tabs, add.fadeto each.tab-pane. The first tab pane must also have .into properly fade in initial content:

<div class="tab-content">

<div class="tab-pane fade in active" id="home">...</div>

<div class="tab-pane fade" id="svn">...</div>

<div class="tab-pane fade" id="ios">...</div>

<div class="tab-pane fade" id="java">...</div>

</div>

Example

An example of tab plugin using data attributes and fade effect is shown in the following example:

<ul id="myTab" class="nav nav-tabs">

<li class="active">

<a href="#home" data-toggle="tab">

Tutorial Point Home </a>

</li>

<li><a href="#ios" data-toggle="tab">iOS</a></li>

<li class="dropdown">

<a href="#" id="myTabDrop1" class="dropdown-toggle"

data-toggle="dropdown">Java <b class="caret"></b>

</a>

<ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1">

185 <li><a href="#jmeter" tabindex="-1" data-toggle="tab">jmeter</a></li>

<li><a href="#ejb" tabindex="-1" data-toggle="tab">ejb</a></li>

</ul>

</li>

</ul>

<div id="myTabContent" class="tab-content">

<div class="tab-pane fade in active" id="home">

<p>Tutorials Point is a place for beginners in all technical areas.

<div class="tab-pane fade" id="ios">

<p>iOS is a mobile operating system developed and distributed by Apple Inc. Originally released in 2007 for the iPhone, iPod Touch, and Apple TV. iOS is derived from OS X, with which it shares the Darwin foundation. iOS is Apple's mobile version of the OS X operating system used on Apple computers.</p>

</div>

<div class="tab-pane fade" id="jmeter">

<p>jMeter is an Open Source testing software. It is 100% pure Java application for load and performance testing.</p>

</div>

<div class="tab-pane fade" id="ejb">

<p>Enterprise Java Beans (EJB) is a development architecture for building highly scalable and robust enterprise level

186

Methods

.$().tab: This method activates a tab element and content container. Tab should have either adata-targetor anhreftargeting a container node in the DOM.

<ul class="nav nav-tabs" id="myTab">

<li class="active"><a href="#identifier" data-toggle="tab">Home</a></li>

...

</ul>

<div class="tab-content">

<div class="tab-pane active" id="home">...</div>

...

</div>

<script>

$(function () {

$('#myTab a:last').tab('show') })

</script>

Example

The following example shows the use of tab plugin method.tab. Here in the example the second tabiOSis activated:

<ul id="myTab" class="nav nav-tabs">

<li class="active"><a href="#home" data-toggle="tab">

Tutorial Point Home</a>

</li>

<li><a href="#ios" data-toggle="tab">iOS</a></li>

<li class="dropdown">

187 <a href="#" id="myTabDrop1" class="dropdown-toggle"

data-toggle="dropdown">Java <b class="caret"></b>

</a>

<ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1">

<li><a href="#jmeter" tabindex="-1" data-toggle="tab">

jmeter</a>

</li>

<li><a href="#ejb" tabindex="-1" data-toggle="tab">

ejb</a>

<div class="tab-pane fade in active" id="home">

<p>Tutorials Point is a place for beginners in all technical areas.

<div class="tab-pane fade" id="ios">

<p>iOS is a mobile operating system developed and distributed by Apple Inc. Originally released in 2007 for the iPhone, iPod Touch, and Apple TV. iOS is derived from OS X, with which it shares the Darwin foundation. iOS is Apple's mobile version of the OS X operating system used on Apple computers.</p>

</div>

<div class="tab-pane fade" id="jmeter">

<p>jMeter is an Open Source testing software. It is 100% pure Java application for load and performance testing.</p>

</div>

<div class="tab-pane fade" id="ejb">

<p>Enterprise Java Beans (EJB) is a development architecture

188

Following table lists the events to work with tab plugin. This event may be used to hook into the function.

Event Description Example

show.bs.tab This event fires on tab show, e.relatedTarget // previous tab })

shown.bs.tab This event fires on tab show after a tab has been shown.

Use event.targetand event.relatedTargetto

189 previous active tab (if

available) respectively.

e.relatedTarget // previous tab })

Example

The following example shows use of tab plugin events. Here in the example we will display the current and previous visited tabs:

<hr>

<p class="active-tab"><strong>Active Tab</strong>: <span></span></p>

<p class="previous-tab"><strong>Previous Tab</strong>:

<span></span></p>

<hr>

<ul id="myTab" class="nav nav-tabs">

<li class="active"><a href="#home" data-toggle="tab">

Tutorial Point Home</a></li>

<li><a href="#ios" data-toggle="tab">iOS</a></li>

<li class="dropdown">

<a href="#" id="myTabDrop1" class="dropdown-toggle"

data-toggle="dropdown">

Java <b class="caret"></b></a>

<ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1">

<li><a href="#jmeter" tabindex="-1" data-toggle="tab">jmeter</a></li>

<li><a href="#ejb" tabindex="-1" data-toggle="tab">ejb</a></li>

</ul>

</li>

</ul>

<div id="myTabContent" class="tab-content">

<div class="tab-pane fade in active" id="home">

<p>Tutorials Point is a place for beginners in all technical areas.

<div class="tab-pane fade" id="ios">

In document bootstrap_tutorial.pdf (Page 195-200)