Closed digitalredefned closed 2 years ago
Try this:
// Change Tab on load let hash = window.location.hash; hash && $('ul.nav a[href="' + hash + '"]').tab('show');
$('.nav-tabs li > a').on('click', function (e) {
$(this).tab('show');
history.pushState(null,null, this.hash);
});
$(window).bind('hashchange', function(){
$('ul.nav a[href^="' + document.location.hash + '"]').click();
});
if (document.location.hash.length) {
$(window).trigger('hashchange');
}
This worked with the modification below since these links aren't nested in a list: $('.nav-tabs > a.nav-link').on('click', function (e) { $(this).tab('show'); history.pushState(null,null, this.hash); });
Appreciate the response and hope you're safe in the DR!
Glad it helped you and worked with the modification, and thanks for your concern of me in the DR :D
I created a tab section of a page for a view using the backend app blade and noticed that when clicking the tabs, the anchors were not being appended to the URL of the account page on the front end.
To debug
The code that performs this looks the same in both files so I'm assuming something else in the file may be causing a conflict.