I am building a web app with Rails 4 and Bootstrap 3.
In one of the pages, I have the following Bootstrap tabs:
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> Profile</a></li>
<li role="presentation"><a href="#billing" aria-controls="billing" role="tab" data-toggle="tab"><span class="glyphicon glyphicon-credit-card" aria-hidden="true"></span> Billing</a></li>
<li role="presentation"><a href="#expert" aria-controls="expert" role="tab" data-toggle="tab"><span class="glyphicon glyphicon-briefcase" aria-hidden="true"></span> Expert</a></li>
</ul>
and then, the following content in these tabs:
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="profile">
</div>
<div role="tabpanel" class="tab-pane" id="billing">
</div>
<div role="tabpanel" class="tab-pane" id="expert">
</div>
</div>
When I hover any of these tabs, I see that the direct URL is, ie: http://localhost:3000/account/edit#profile
, http://localhost:3000/account/edit#billing
and http://localhost:3000/account/edit#expert
.
However, when I try to link directly to the tab from another page, the active tab is still the first one (not the one I linked to).
Two notes:
I am using Bootstrap tabs "without any JavaScript", as explained in the markdown section in the documentation.
I would like to link to these tabs using Rails
link_to
helper.
Any idea why this is not working?