Hi Team,
I have an issue with the tabs active url while page loads
First i use this js function for tabs
$(document).ready(function() {
$('.tabs, .tabsforfinishes').each(function(){
var active, content, links = $(this).find('a');
active = links.first().addClass('active');
content = $(active.attr('href'));
links.not(':first').each(function () {
$($(this).attr('href')).hide();
});
$(this).find('a').click(function(e){
active.removeClass('active');
content.hide();
active = $(this);
content = $($(this).attr('href'));
active.addClass('active');
content.show();
return false;
});
});
});
Next use this below code for append the hash in url
$(function(){
var hash = window.location.hash;
hash && $('.tabs a[href="' + hash + '"]').tab('show');
$('.tabs a').click(function (e) {
$(this).tab('show');
var scrollmem = $('body').scrollTop();
window.location.hash = this.hash;
$('html,body').scrollTop(scrollmem);
});
});
All good for this step and in page its works fine it shows the url while changing the tab
but i need to the hash link to another page if i click the link from that page i need to get the correct tab active
Like i link #tab-2 to another page i click the link from another page it goes to the particular tav active place but its does not work
Any Solutions
Thanks.