jquery - Bootstrap: How can I use switch tabs from the menu bar? -


i have built justified tabs in body. same tabs sub menus(dropdown) in navigation menu. how can switch tabs directly menu when click dropdown?

here code tried. navigation menu.

<ul class="dropdown-menu">     <li><a href="#letenky" data-toggle="tab">empresa</a></li>     <li><a href="#hotel" data-toggle="tab">clientes</a></li>     <li><a href="#auto" data-toggle="tab">na mÍdia</a></li> </ul> 

and code tabs normally.

<ul id="tabs" class="nav nav-tabs nav-justified" data-tabs="tabs">     <li><a href="#letenky" data-toggle="tab">         <p>empresa</p>     </a></li>     <li class="active"><a href="#hotel" data-toggle="tab">         <p>clientes</p>     </a></li>     <li><a href="#auto" data-toggle="tab">         <p>na mÍdia</p>     </a></li> </ul> 

for reference, final layout. http://aijaz.co/angloamerican/clientes.html

thanks.

all need add data-toggle="tab" attribute links:

<ul class="dropdown-menu">     <li><a href="#letenky" data-toggle="tab">empresa</a></li>     <li><a href="#hotel" data-toggle="tab">clientes</a></li>     <li><a href="#auto" data-toggle="tab">na mÍdia</a></li> </ul> 

edit

based on comments below, better approach use javascript:

$('.dropdown-menu a').on('click', function() {     $('#tabs').find('a[href='+$(this).prop("href")+']').click(); }); 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -