Created
October 12, 2013 23:11
-
-
Save kirankumaramruthaluri/6956013 to your computer and use it in GitHub Desktop.
Bootstrap Switching among Tabs
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<!-- Le styles --> | |
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script> | |
</head> | |
<body> | |
<div class="container"> | |
<center><h6>Switching Among the Tabs</h6></center> | |
<div id="content"> | |
<ul id="tabs" class="nav nav-tabs" data-tabs="tabs"> | |
<li class="active"><a href="#red" data-toggle="tab">Red</a></li> | |
<li><a href="#orange" data-toggle="tab">Orange</a></li> | |
<li><a href="#yellow" data-toggle="tab">Yellow</a></li> | |
<li><a href="#green" data-toggle="tab">Green</a></li> | |
<li><a href="#blue" data-toggle="tab">Blue</a></li> | |
</ul> | |
<div id="my-tab-content" class="tab-content"> | |
<div class="tab-pane active" id="red"> | |
<h1>Red</h1> | |
<p>red red red red red red</p> | |
<button>Blue</button> | |
</div> | |
<div class="tab-pane" id="orange"> | |
<h1>Orange</h1> | |
<p>orange orange orange orange orange</p> | |
<button>Blue</button> | |
</div> | |
<div class="tab-pane" id="yellow"> | |
<h1>Yellow</h1> | |
<p>yellow yellow yellow yellow yellow</p> | |
<button>Blue</button> | |
</div> | |
<div class="tab-pane" id="green"> | |
<h1>Green</h1> | |
<p>green green green green green</p> | |
<button>Blue</button> | |
</div> | |
<div class="tab-pane" id="blue"> | |
<h1>Blue</h1> | |
<p>blue blue blue blue blue</p> | |
<button>Blue</button> | |
</div> | |
</div> | |
</div> | |
<script type="text/javascript"> | |
jQuery(document).ready(function ($) { | |
$('#tabs').tab(); | |
}); | |
$('button').addClass('btn-primary').text('Switch to Orange Tab'); | |
$('button').click(function(){ | |
$('#tabs a[href=#orange]').tab('show'); | |
}); | |
</script> | |
</div> <!-- container --> | |
<script type="text/javascript" src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment