Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #754393

    Hey guys,

    Thanks for the great 4.0 Update. I have one question regarding the new tab section. Is it possible to open a tab from a Link?
    I have a Image with Hotspots in every Tab and I want to link the Hotspots to the individual tabs.

    Link to the Site

    Thanks a lot for your help.

    Regards Martin

    #757263

    Hey Martin,

    Sorry for the late response, I’m not really sure what you meant but there’s no option for links in tabs, but if it’s a link you just click and open for example the 2nd tab, it should be possible by using this url pattern:

    http://domain.com/mypage/#tab-id-2

    Hope this helps.

    Best regards,
    Nikko

    #761877

    Hey Nikko,

    Thanks for your reply. Yes this works for normal tabs but nor for the new Tab Section.
    There is no URL Parameter to change the tabs.

    Thanks for your help.

    Regards Martin

    #763509

    Hi,

    Please follow the instructions here:

    // https://kriesi.at/support/topic/different-layout-for-blog-layout-and-certain-category-layout/#post-624419
    // https://kriesi.at/support/topic/linking-to-filtered-portfolio-ajax/#post-430830

    For the tab, this script should work:

    // 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 '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
    }

    The url should look something this:

    http://www.mysite.com/myportfolio?tabsort=2
    

    This will trigger the second tab.

    Best regards,
    Ismael

    #769274

    Hi Ismael,

    I wanted this functionality too, however, my tab section is down the page so I needed to link to it with an anchor as well. I found it worked if I added ?tabsort=3#anchor-id to URLs. (Just thought I would share).

    My question is, if I have a link/button in a tab e.g. tabsort=1 and I want to link to trigger showing another tab in that tab section e.g. tabsort=3, how do I do it without reloading the page. Essentially I would like the same functionality as clicking on the tab section navigation.

    Many thanks,
    Nik

    #769725

    Hey!

    @Twisted Pear: Could you please provide a link to the page with the nested tabs? I think this is possible but having a tab inside another tab is not good idea because you’re unintentionally hiding the content from your users. Be mindful of the Three-click rule when designing your content.

    Best regards,
    Ismael

    #769729

    Hi Ismael,

    Sorry, I don’t want to nest tabs, I simply wish to have a button that promotes to a particular tab in that tab section.

    I have provided a link.
    Please click on “Find a Technical Essentials Class” to see what I have done as a workaround.
    I would prefer it would just promote to the “Schedule” tab rather than reloading the page and then going to it.

    Many thanks,
    Nik

    #769737

    Hey!

    Remove the link or href value of the button then add a unique class attribute to it. Use the button to trigger the “Schedule” tab title. Something like this:

       function b() {
            $('.customcssforthebutton a').on('click', function(e) {
                e.preventDefault();
                $('a[data-av-tab-section-title="3"]').trigger('click');
            });
        }
    
        b();

    Regards,
    Ismael

    #769745

    Hi Ismael,

    That did it.
    Consider topic closed.

    Many thanks,
    Nik

    #770529

    Hi Nik,

    Great, glad we could help and thanks for the feedback. Please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

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