From a2c263493a7b6ca1933778feada80bab38c78581 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Tue, 4 Oct 2011 22:11:44 -0700 Subject: [PATCH] add dropdown tab selection support --- docs/javascript.html | 13 +++++++++++++ js/bootstrap-tabs.js | 19 ++++++++++++++----- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/docs/javascript.html b/docs/javascript.html index 2891c44602..3c3c818fe7 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -383,6 +383,13 @@ $('#.tabs').bind('change', function (e) {
  • Profile
  • Messages
  • Settings
  • +
    @@ -397,6 +404,12 @@ $('#.tabs').bind('change', function (e) {

    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.

    +
    +

    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.

    +
    +
    +

    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.

    +
    diff --git a/js/bootstrap-tabs.js b/js/bootstrap-tabs.js index e8e2dc622d..9ccf854365 100644 --- a/js/bootstrap-tabs.js +++ b/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') + element.addClass('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) ) { e.preventDefault() - if ($this.parent('li').hasClass('active')) { + if ( $this.parent('li').hasClass('active') ) { return } - previous = $ul.find('.active a')[0] + previous = $ul.find('.active a').last()[0] $href = $(href) activate($this.parent('li'), $ul)