Creating a unique URL to a specific tab

Hi @AlyssaLaurenDesigns,

Sorry, it looks like you’ll need custom code in combination with the IDs, if you just add this code to Treatments > Page Settings > Custom Code > Before </body> tag:

<script>
$( function() {
    function changeTab() {
        var tabName = window.location.hash.substr(1);
        var tabEl = $('[data-w-tab="' + tabName + '"]');
        if (tabEl.length) {
            tabEl.click();
        }
    }

    //when page is first loaded
    if(window.location.hash){
        changeTab();
    }

    //internal page linking
    $(window).on('hashchange', changeTab);

    $('[data-w-tab]').on('click', function(){
        history.pushState({}, '', '#'+$(this).data("w-tab"));
    });
});
</script>

Code source here: Solution - creating an URL link for a specific tab

Let me know how you go!

2 Likes