I'm unable to get sidebar links to navigate to bootstrap 4 tabs on the center page using this technique. Here is the javascript in my _SidebarLayout.cshtml
:
<script>
function selectTabNamedInUrlHash() {
let selectedTab = window.location.hash;
$('.nav-link[href="' + selectedTab + '"]').trigger('click');
}
jQuery(document).ready(function ($) {
selectTabNamedInUrlHash();
})
</script>
A sidebar anchor links to the page and adds a fragment (hash) to the href of the tab I want to navigate to (url end: SPC#SpcFilm). The sidebar link also calls the above function.
<a onclick="selectTabNamedInUrlHash();" asp-page="/SPC/Index" asp-fragment="SpcFilm">Film</a>
On Index.cshtml the Bootstrap 4 tab is identified by href="#SpcFilm"
This solution works when navigating to a new page, but it's not working when navigating to another tab on the same page.