-
AuthorPosts
-
March 17, 2015 at 2:52 pm #229424
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();
});});
March 17, 2015 at 6:20 pm #229616Hi 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.
March 17, 2015 at 7:56 pm #229666This 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.
March 17, 2015 at 8:59 pm #229697As an example.. here is a URL sample format that I am trying to use:
I am trying to create a button anywhere on the site or from an outside site that will automatically open collapse-7 which is inside of tab-4 of the URL /business-continuity-consulting. I hope that this explanation is helpful. Please advise. Thanks.
March 18, 2015 at 1:55 am #229851Hi,
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
March 18, 2015 at 10:25 pm #230762This reply has been marked as private.March 19, 2015 at 5:18 am #230905Hi 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!
-
AuthorPosts