<section class="ask-librarian-from">
<div class="container">
<div class="row split-area">
<div class="col-md-8">
<div class="form-block active" id="libtab1">
<div class="form-title">
content1
</div>
</div>
<div class="form-block " id="libtab2">
<div class="form-title">
content 2
</div>
</div>
<div class="form-block " id="libtab3">
<div class="form-title">
content 3
</div>
</div>
<div class="form-block " id="libtab4">
<div class="form-title">
content 4
</div>
</div>
</div>
<div class="col-md-4">
<div class="tab-wrap mCustomScrollbar">
<div class="vertical-tabs right-align-tab scrollContainer" id="verticalTabsScroll" data-mcs-theme="dark">
<a href="#libtab1" class="tab_item active">
content tab 1
</a>
<a href="#libtab2" class="tab_item ">
content tab 2
</a>
<a href="#libtab3" class="tab_item ">
content tab 3
</a>
<a href="#libtab4" class="tab_item ">
content tab 4
</a>
</div>
</div>
</div>
</div>
</div>
</section>
我只想使用URL或链接来激活选项卡.那就是当我转到www.mydomain.com/page/#libtab2时,它会自动打开并激活’libtab2’选项卡及其内容,并隐藏所有其他选项卡的内容.
最佳答案
这段代码如何加载?
原文链接:https://www.f2er.com/html/530413.html$(document).ready(function() {
$('.ask-librarian-from .vertical-tabs a').removeClass('active');
$('a[href]="' + window.location.hash + '"').addClass('active');
$('.ask-librarian-from').find('.form-block').removeClass('active');
$('.ask-librarian-from').find(window.location.hash).addClass('active');
)