• Resolved mike3hastie

    (@mike3hastie)


    I’m using getwid tabs. I’d like to link to a specific tab.

    I’m not very good with javascript. I’ve tried writing a code but it doesn’t work. Could someone help?

    const activate_tab = urlParams.get(‘tab’);
    var indexValue = 1;
    $(“[class=’wp-block-getwid-tabs__nav-link’]”).each(function( index, element ) {
    var $input = $(this);
    // element == this
    if (indexValue == activate_tab) {
    $input.attr(“tabindex”, 0);
    $input.attr(“aria-selected”, true);
    $input.attr(“aria-expanded”, true);
    $input.addClass(“ui-tabs-active”);
    $input.addClass(“ui-state-active”);
    }else{
    $input.attr(“tabindex”, -1);
    $input.attr(“aria-selected”, false);
    $input.attr(“aria-expanded”, false);
    $input.removeClass(“ui-tabs-active”);
    $input.removeClass(“ui-state-active”);
    }
    indexValue += 1;
    });`

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support dimned

    (@dimned)

    Hi @mike3hastie,
    Thanks for your question. Unfortunately, there is not an option to set a link for each tab at the moment. I’ve added your request to our list of features. Perhaps it will be possible within one of the further updates. Stay tuned and check the release notes not to miss an update with this feature.

    celes15

    (@celes15)

    Hi @mike3hastie

    I tried to solve this topic and I created little script:

    if(window.location.hash) {
          var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
    	var navi = $('.wp-block-getwid-tabs__nav-link:nth-child('+ hash + ') a'); 
    	navi.click();
    }

    If you want to link to second tab you need to use anchor – page#2
    For 1st tab you don’t need it.

    Check it for me it’s working.

    Have a nice day ??

    • This reply was modified 3 years ago by celes15.
    • This reply was modified 3 years ago by celes15.
    • This reply was modified 3 years ago by celes15.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to I link to specific tab?’ is closed to new replies.