jquery - Toggle "tabbable" - bootstrap -
i'm trying achieve i'm relatively sure has been done several times before, can't seem find documetation on it.
i'm using responsive bootstrap this, , affected functionality revolves around "tabbable" component. (see below)
<div class="tabbable"> <!-- required left/right tabs --> <ul class="nav nav-tabs"> <li class="active"><a href="#tab1" data-toggle="tab">section 1</a></li> <li><a href="#tab2" data-toggle="tab">section 2</a></li> </ul> <div class="tab-content"> <div class="tab-pane active" id="tab1"> <p>i'm in section 1.</p> </div> <div class="tab-pane" id="tab2"> <p>howdy, i'm in section 2.</p> </div> </div> </div>
what trying achieve functionality hides content of tab if active. (in example above, clicking active < >
should remove "active"
class both button , related div (#tab1
) in way poses no threat tabbable functionality)
i think there simple solution this, being new bootstrap however, haven't been able locate yet , don't want dig own grave using obsure javascript solution.
edit: after comment wanted clarify query more. want no tabs @ shown if click on button related div in in active state, in other words, want click work same way .toggle works in jquery, flipswitch.
any ideas/input appriciated!
i don't think there way using html markup , data attributes. if can acheived little javascript (not obscure!)..
$('[data-toggle=tab]').click(function(){ if ($(this).parent().hasclass('active')){ $($(this).attr("href")).toggleclass('active'); } })
Comments
Post a Comment