Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #229424

    sld
    Participant

    Hi -Is there a way to open a specific accordion inside of a specific tab on a specified page via an a href link? For example:

    I create a button a page x.com/services. I want this link open accordion 3 that is inside tab-4 on page x.com/solutions. I have the following code already in my custom javascript from another forum page and am able to click through to a specific tab without issue. I just can’t get the specific accordion to open as well inside of the target tab. Any help that you can provide would be appreciated. Thanks. Here is the javascript code that I have:

    jQuery(function($){

    $(document).ready(function(){ jump_to_tab( $, $(‘.x-nav-tabs .x-nav-tabs-item a[href=”#’ + location.href.split(“#”).slice(-1)[0] + ‘”], .x-accordion-toggle a[href=”#’ + location.href.split(“#”).slice(-1)[0] + ‘”]’) ); });
    $(‘.enable_jump_to’).click( function(e){ e.preventDefault(); jump_to_tab($, $(‘.x-nav-tabs .x-nav-tabs-item a[href=”‘ + $(this).attr(‘data-jump-target’) + ‘”], .x-accordion-toggle a[href=”‘ + $(this).attr(‘data-jump-target’) + ‘”]’) ); } );

    });

    function jump_to_tab($, tab_nav) {
    if(tab_nav.length >=1) {
    $(tab_nav).click();
    $(‘html,body’).animate({scrollTop: $(tab_nav).offset().top – ( $(‘.x-navbar’).height() + 50 )},700 ,’swing’);
    }
    }

    jQuery( function($) {

    $(document).on(‘click’, ‘.x-accordion-toggle, .x-nav-tabs .x-nav-tabs-item a’, function( e ){
    $(‘html, body’).stop();
    });

    });

    #229616

    Friech
    Moderator

    Hi There,

    Thanks for writing in! Regretfully, we cannot provide support for third party scripts as our support policy in the sidebar states due to the fact that there is simply no way to account for all of the potential variables at play when using another developer’s script.

    Thank you for your understanding.

    #229666

    sld
    Participant

    This is not a third party script. This is from your forum – code that your team wrote to place in the custom javascript area. Here is the page that it came from for reference: http://theme.co/x/member/forums/topic/open-accordion-from-link/#post-69749

    Please take a look at this again. Thanks.

    #229697

    sld
    Participant
    #229851

    Paul R
    Moderator

    Hi,

    We need to see your current set-up.

    Can you to provide us with your URL.
    This is to ensure that we can provide you with a tailored answer to your situation.

    Thanks

    #230762

    sld
    Participant
    This reply has been marked as private.
    #230905

    Zeshan
    Member

    Hi Sid,

    Thanks for the URL!

    Upon checking, it seems a double functionality, that is, using a link to first open a tab and then an accordion item inside that tab. As the nature of the provided code, it splits the anchor link from the URL (i.e., #tab-4) and search for an tab or accordion item with that ID and opens it. That is, only one process can be done at a time. In your case, it’s different.

    This could be possible with more advance JS customization. We’d really love you help you with it, but regretfully it would fall beyond the scope of support we can provide. The provided code should work just fine for the context discussed originally. If you want to have more in depth customizations as per your needs, you may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities.

    Thanks for understanding. Take care!