Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

add dropdown tab selection support

  • Loading branch information...
1 parent 100954e commit a2c263493a7b6ca1933778feada80bab38c78581 @fat fat committed
Showing with 27 additions and 5 deletions.
  1. +13 −0 docs/javascript.html
  2. +14 −5 js/bootstrap-tabs.js
13 docs/javascript.html
@@ -383,6 +383,13 @@
<li><a href="#profile">Profile</a></li>
<li><a href="#messages">Messages</a></li>
<li><a href="#settings">Settings</a></li>
+ <li class="dropdown" data-dropdown="dropdown">
+ <a href="#" class="dropdown-toggle">Dropdown</a>
+ <ul class="dropdown-menu">
+ <li><a href="#fat">@fat</a></li>
+ <li><a href="#mdo">@mdo</a></li>
+ </ul>
+ </li>
<div id="my-tab-content" class="tab-content">
<div class="active" id="home">
@@ -397,6 +404,12 @@
<div id="settings">
<p>Sunt qui biodiesel mollit officia, fanny pack put a bird on it thundercats seitan squid ad wolf bicycle rights blog. Et aute readymade farm-to-table carles 8-bit, nesciunt nulla etsy adipisicing organic ea. Master cleanse mollit high life, next level Austin nesciunt american apparel twee mustache adipisicing reprehenderit hoodie portland irony. Aliqua tofu quinoa +1 commodo eiusmod. High life williamsburg cupidatat twee homo leggings. Four loko vinyl DIY consectetur nisi, marfa retro keffiyeh vegan. Fanny pack viral retro consectetur gentrify fap.</p>
+ <div id="fat">
+ <p>Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.</p>
+ </div>
+ <div id="mdo">
+ <p>Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.</p>
+ </div>
19 js/bootstrap-tabs.js
@@ -21,24 +21,33 @@
!function( $ ){
function activate ( element, container ) {
- container.find('> .active').removeClass('active')
+ container
+ .find('> .active')
+ .removeClass('active')
+ .find('> .dropdown-menu > .active')
+ .removeClass('active')
+ if ( element.parent('.dropdown-menu') ) {
+ element.closest('li.dropdown').addClass('active')
+ }
function tab( e ) {
var $this = $(this)
- , $ul = $this.closest('ul')
+ , $ul = $this.closest('ul:not(.dropdown-menu)')
, href = $this.attr('href')
, previous
- if (/^#\w+/.test(href)) {
+ if ( /^#\w+/.test(href) ) {
- if ($this.parent('li').hasClass('active')) {
+ if ( $this.parent('li').hasClass('active') ) {
- previous = $ul.find('.active a')[0]
+ previous = $ul.find('.active a').last()[0]
$href = $(href)
activate($this.parent('li'), $ul)

0 comments on commit a2c2634

Please sign in to comment.
Something went wrong with that request. Please try again.