Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1155481
    chugginn
    Participant

    I’d like to link to an accordion item from a different page. Not only would I like the link to anchor to the item, but I’d like the accordion to expand as well. I found this thread which accomplishes the task but on an older version of X. From that thread, I found this newer thread but it does not discuss the issue of the accordion. Thanks in advance!

    #1155535
    Rupok
    Member

    Hi there,

    The suggestion of first thread should still work. Please try that and let us know.

    Thanks!

    #1155914
    chugginn
    Participant
    This reply has been marked as private.
    #1156198
    Rue Nel
    Moderator

    Hello There,

    Thank you for the information. To resolve this issue, please add the following JS code in the customizer, Appearance > Customize > Custom > Javascript

    
    (function($){
      $(window).on('load', function(){
        var pageAddress = window.location.hash;
    
    	  if ( pageAddress || pageAddress != '' ) {
    
    	    console.log(pageAddress);
    
    	    var navbar = $('.x-navbar').outerHeight();
    	    var yloc = $(pageAddress).offset().top - 160;
    	    console.log($(pageAddress).offset().top);
    	    console.log('tab: ' + pageAddress + ', yloc: ' + yloc);
    	    
    	    $(pageAddress + ' .x-accordion-toggle').trigger('click');
    
    	    $('html, body').animate({
    	        scrollTop: yloc
    	      }, 850, 'easeInOutExpo');
    	  }
      });
    })(jQuery);

    Please let us know if this works out for you. Thank you.

  • <script> jQuery(function($){ $("#no-reply-1155481 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>