Reputation: 301
I am using a plugin for tabs, if I set a link to be www.mysite.com/page#tab2, how can that URL open the tab, here is their structure:
<div id="tabs" class="txtabs-wrap style1">
<ul class="txtabs-nav top clearfix">
<li class="first active">
<a data-target="#tabs-0" data-toggle="tab">
<span>Lorem</span>
</a>
</li>
<li class="last">
<a data-target="#tabs-2" data-toggle="tab">
<span>Lorem</span>
</a>
</li>
Upvotes: 0
Views: 62
Reputation: 87203
Based on your HTML
structure:
if (window.location.hash) {
$('[data-target="' + window.location.hash + '"]')
.closest('li').addClass('active')
.siblings('li').removeClass('active');
}
Upvotes: 1