Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1285928
    slking1989
    Participant

    Hi,

    I am trying to use a button to open an accordian. So far i have found the following code which will take me to the accordian on the page. However this will not open a collapsed accordian and i cannot find the correct JS to do this.

    Any help will be appreciated

    jQuery(document).ready(function($) {
      $('.open_accordion').click(function(e) {
        
        var $this = $(this);
        var thisHref = $this.attr('href');
        var accordion = $(thisHref).find('.x-accordion-toggle');
    
        if ( accordion.length && $(thisHref).hasClass('x-accordion-group') ) {
          e.preventDefault();
    
          accordion.trigger('click');
        }
    
      });
    #1285929
    slking1989
    Participant

    Help 🙂

    #1286025
    Paul R
    Moderator

    Hi,

    Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

    #1286249
    slking1989
    Participant

    Hi Paul

    Thanks for your response.

    Here is the URL

    http://fm-factory.com/graphics/skins/vitrex-1-3/

    #1286439
    Rahul
    Moderator

    Hi,

    Thank you for providing your url.

    To make it work on your prompt’s button, you can change the javascript code to this.

    jQuery(document).ready(function($) {
      $('.open_accordion .x-btn').click(function(e) {
        
        var $this = $(this);
        var thisHref = $this.attr('href');
        var accordion = $(thisHref).find('.x-accordion-toggle');
    
        if ( accordion.length && $(thisHref).hasClass('x-accordion-group') ) {
          e.preventDefault();
    
          accordion.trigger('click');
        }
    
      });
    });

    Hope that helps.

    #1287704
    slking1989
    Participant

    Unfortunatly that did not help.

    That code also looks very familiar to the one i said i am trying.

    #1288046
    Rue Nel
    Moderator

    Hello There,

    Sorry if it doesn’t work out for you. please have the JS code updated and use this instead:

    jQuery(document).ready(function($) {
      $('.open-accordian.x-btn').click(function(e) {
        
        var $this = $(this);
        var thisHref = $this.attr('href');
        var accordion = $(thisHref).find('.x-accordion-toggle');
    
        console.log(thisHref);
        e.preventDefault();
    
        accordion.trigger('click');
    
      });
    });

    We would loved to know if this has work for you. Thank you.

    #1291122
    slking1989
    Participant

    Unfortunately it did not work.

    #1291198
    Paul R
    Moderator

    Hi,

    I no longer see a button on this page – http://fm-factory.com/download/vitrex-1-3/

    Can you create another test page with your button and accordion.

    Thanks

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