Is it possible to add a class to a specific tab from another page.
My example is, I on the home page, I have a slider with 3 slides. There is a call to action on each slide which needs to link to a tab on another page.
So if I have
<a href="<?php bloginfo ('url');?>/features/#anchorname
on the home page, is there a way of adding an active class on page load to the specific tab?
This is how the content is showed on the page that it needs to be linked to. https://gist.github.com/anonymous/11bbffb588baa4acc55392ff50592993
Thanks in advance. Paddy
The regex gets anchors on URL.
I see that you're not using jQuery, you can try with this
var active_section = '' + document.URL.match(/(?:#).*/) ;
if(document.querySelector("a.tab.active")){
document.querySelector("a.tab.active").classList.remove('active');
}
document.querySelector('[href="'+active_section+'"]').className += ' active';