Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1063183

    I have created a page which includes the Tab section element – https://tapintoit.org.uk/one-to-one/

    I would like to be able to create a URL for each tab i.e. if I wanted someone to look at the pricing on this page I could give them a URL that would open that tab on this page – https://tapintoit.org.uk/one-to-one/ rather than it open, by default, on tab 1 – Benefits.

    I am not a developer and see that there have been other discussions regarding this issue.

    I added the code suggested in other messages to my child theme functions.php and refreshed the website but nothing happened.

    // auto trigger
    add_action(‘wp_footer’, ‘ava_custom_script’);
    function ava_custom_script() {
    ?>
    <script>
    (function($){
    function getQueryParams(qs) {
    qs = qs.split(“+”).join(” “);
    var params = {},
    tokens,
    re = /[?&]?([^=]+)=([^&]*)/g;

    while (tokens = re.exec(qs)) {
    params[decodeURIComponent(tokens[1])]
    = decodeURIComponent(tokens[2]);
    }

    return params;
    }

    var $_GET = getQueryParams(document.location.search);

    $(window).load(function() {
    switch($_GET[‘tabsort’]) {
    case ‘Benefits’:
    $(‘a[data-av-tab-section-title=”Benefits”]’).trigger(‘click’);
    break;
    case ‘Get Set Up’:
    $(‘a[data-av-tab-section-title=”Get Set Up”]’).trigger(‘click’);
    break;
    case ‘Get Started’:
    $(‘a[data-av-tab-section-title=”Get Started”]’).trigger(‘click’);
    break;
    case ‘Support’:
    $(‘a[data-av-tab-section-title=”Support”]’).trigger(‘click’);
    break;
    case ‘Pricing’:
    $(‘a[data-av-tab-section-title=”Pricing”]’).trigger(‘click’);
    break;
    }
    });
    })(jQuery);
    </script>
    <?php
    }

    But I am not sure that this is the correct script for what I have on my page – I don’t have buttons on my tabs….

    Please can someone explain the stages simply i.e. step by step as I am not a developer and I am building this on a voluntary basis.

    Many thanks

    #1063733

    Please help…..

    #1064557

    Hi still waiting for some help….

    #1065319

    Hi,

    Thank you for using Enfold. And I would like to apologize for the late response.

    The tab section has changed a lot since, so that script is no longer valid. Please try this one instead:

    // auto trigger tab section
    add_action('wp_footer', 'ava_go_to_tab_section');
    function ava_go_to_tab_section() {
    ?>
    <script>
    (function($){
        function getQueryParams(qs) {
            qs = qs.split("+").join(" ");
            var params = {},
            tokens,
            re = /[?&]?([^=]+)=([^&]*)/g;
    
            while (tokens = re.exec(qs)) {
                params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]);
            }
    
            return params;
        }
    
        function triggerTabSection( section) {
            $('a[href="' + section + '"]').trigger('click');
        }
    
        var section = getQueryParams( document.location.search );
    
        triggerTabSection( section );
    })(jQuery);
    </script>
    <?php
    }

    Best regards,
    Ismael

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.