Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1211705

    Hi
    I’m trying to create links to a specific tab on a page. I want the user to be able to go to a specific tab by choosing the tab from the main menu but also from a link on another page on my site.
    The tabs are created in a Tab Section (Where it’s possible to add Title and icons or image). The Tab Section is a bit down in the page so I guess I need an anchor as well.

    If I enter an anchor in the Custum ID Attribute of the Tab Section. The anchor doesn’t work. But if I put an anchor in the Custom ID Attribute of the column containing a Special heading element just above the the Tab Section – that anchor works.

    I have tried to create links but I’m doing something wrong since the links doesn’t work.
    Would need som help from you guys!

    I have also added this code in functions.php from another support case. But I got unsure if it’s working for the kind of tabs I’m using. If it’s correct – I guess I need to the numbers of tabs I’m using in the Tab Section?

    // auto trigger get tabs
    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 ‘1’:
    $(‘a[data-av-tab-section-title=”1″]’).trigger(‘click’);
    break;
    case ‘2’:
    $(‘a[data-av-tab-section-title=”2″]’).trigger(‘click’);
    break;
    case ‘3’:
    $(‘a[data-av-tab-section-title=”3″]’).trigger(‘click’);
    break;
    case ‘4’:
    $(‘a[data-av-tab-section-title=”4”]’).trigger(‘click’);
    break;
    }
    });
    })(jQuery);
    </script>
    <?php
    }

    #1213084

    Hi guys. I still have this problem with the links to a tab section.

    #1213650

    Hi,
    Sorry for the late reply, when I check your links page I find the link to the tab section is #Tabsection but it should be #tabbransch .
    I don’t believe that script is needed anymore, you can link to a tab using the ID, but you can not link to a section inside of a tab.

    Best regards,
    Mike

    #1214140

    Hi
    I think you need to have another look.
    I want to open this with my link: The second tab (the tab named “Försäkring”) in my Tab section in the page “Kundcase” .
    The anchor “tabbransch” on the Tab section works so far as it goes to the tab section – when i use lowercases. Great!.
    But I also want the tab “Försäkring” to be opened. What should I add in the link to open the second tab?
    According to your documentation it should be possible. https://kriesi.at/documentation/enfold/tab-sections/#toggle-id-1

    I have tried the following without no luck, so please tell me where I get it wrong.
    /kundcase/#tabbransch#tab-id-2
    /kundcase/#tabbransch#foersaekring

    From the documentation “Link to a specific tab on the tab section
    When a link is clicked if you like to direct the user to a specific tab section it is possible by using a tab section ID in the URL as shown below:
    http://domain.com/mypage/#tab-id-2

    #1214306

    Hi,
    Thanks for the login, I disabled your custom function and added this one to your child theme functions.php

    function custom_script(){
      ?>
      <script>
    (function($){
      $(document).ready(function(){
    $("a.av-section-tab-title").each(function() {
       var $this = $(this);       
       var _href = $this.attr("href"); 
       var itemId = _href.substring(1, _href.length);
       $this.attr("id", itemId);
    });
    });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'custom_script');

    Now directly going to /kundcase/#foersaekring opens the tab and scrolls to it.
    Please clear your browser cache and check.

    Best regards,
    Mike

    #1215188

    Awesome!
    Thank you for your excellent help.
    Consider the case closed.
    /Ulrika

    #1215511

    Hi Pro4uPro4u,

    Glad Mike helped you out :)

    If you need further assistance please let us know.
    Best regards,
    Victoria

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Link to a tab in a Tab Section’ is closed to new replies.