Hallo,
ich habe folgendes Problem. Ich möchte, dass ein tab in Bootstrap ausgewählt wird, wenn ich auf einer bestimmten URL bin.
Wenn zum Beispiel diese URLS abgerufen werden:
www.xxxx.de/thema1
www.xxxx.de/thema2
www.xxxx.de/thema3
www.xxxx.de/thema4
www.xxxx.de/thema5
Soll das "profile-tab" geöffnet sein.
Wäre super, wenn ihr mir da helfen könntet.
ich habe folgendes Problem. Ich möchte, dass ein tab in Bootstrap ausgewählt wird, wenn ich auf einer bestimmten URL bin.
Wenn zum Beispiel diese URLS abgerufen werden:
www.xxxx.de/thema1
www.xxxx.de/thema2
www.xxxx.de/thema3
www.xxxx.de/thema4
www.xxxx.de/thema5
Soll das "profile-tab" geöffnet sein.
Wäre super, wenn ihr mir da helfen könntet.
HTML:
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" id="contact-tab" data-toggle="tab" href="#contact" role="tab" aria-controls="contact" aria-selected="false">Contact</a>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">...</div>
<div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">...</div>
<div class="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">...</div>
</div>
<script>
$('#myTab a').on('click', function (e) {
e.preventDefault()
$(this).tab('show')
})
</script>