WordPress.org

Ready to get started?Download WordPress

Forums

Shortcodes Ultimate
Close the accordion (6 posts)

  1. bretonargentin
    Member
    Posted 2 years ago #

    Accordion works well to open, but impossible to close it.
    Any idea ?
    Thanks
    http://klasel.com/management/2012/02/28/romain-pascal-tenor/

    http://wordpress.org/extend/plugins/shortcodes-ultimate/

  2. bretonargentin
    Member
    Posted 2 years ago #

    Any help ?

  3. ZainB
    Member
    Posted 2 years ago #

    Hi bretonargentin,

    Try this... it seems to work (although I would really like to see it in the actual plugin!):

    1. Go to the "wp-content/plugins/shortcodes-ultimate/js/" folder
    2. Important: Back-up the "init.js" file
    3. Open the "init.js" file in your favourite HTML editor
    4. On lines 18-23, look for the following block of code:
      if ( spoiler.hasClass('su-spoiler-open') ) {
          if ( !isAccordion ) {
              content.hide(200);
              spoiler.removeClass('su-spoiler-open');
          }
      }
    5. Just after the } on line 23, add the following code:
      else {
          spoiler.parent('.su-accordion').children('.su-spoiler').removeClass('su-spoiler-open');
          spoiler.parent('.su-accordion').find('.su-spoiler-content').hide(200);
      }
    6. Save the file
    7. Test the open and close.

    That seems to work for me. You may want to test the "Spoiler" functionality to make sure it works the way you want it to as well.

    For my purposes, I only use the accordion and this tweak works okay. I hope that helps solve your issue.

    Remember: The only downside is, you must backup these changes... because if the plugin is automatically updated, then you'll lose the changes you've just added.

    Hopefully, this change will be added and updated in the next version of the plugin... fingers crossed!

    Cheers,

    Zain

  4. bretonargentin
    Member
    Posted 2 years ago #

    Thanks Zain but I already have this code in the file.
    I use 3.7.0 version

    I don't know how to fix this issue...

  5. ZainB
    Member
    Posted 2 years ago #

    Hi bretonargentin,

    I'm using 3.7.0 as well - this code won't be in your file (as it's a tweak I made so the tabs would close!).

    Anyway, just to clarify, it may look like you already have this code but actually, it's the part after line 23 that you need to make.

    Lines 18 - 24 will look like this:

    if ( spoiler.hasClass('su-spoiler-open') ) {
        if ( !isAccordion ) {
            content.hide(200);
            spoiler.removeClass('su-spoiler-open');
        }
     }
     else {

    You will need to change lines 18-24 so that it now reads:

    if ( spoiler.hasClass('su-spoiler-open') ) {
        if ( !isAccordion ) {
            content.hide(200);
            spoiler.removeClass('su-spoiler-open');
        } else {
            spoiler.parent('.su-accordion').children('.su-spoiler').removeClass('su-spoiler-open');
            spoiler.parent('.su-accordion').find('.su-spoiler-content').hide(200);
        }
     }
     else {

    As you can see, I've just used the same code to close but this time what is does the function checks to see if it's already open.

    Like I say, it seems to work for me.

    Good luck!

    Cheers,

    Zain

  6. Dreb
    Member
    Posted 1 year ago #

    @ZainB You got it right. At first i also thought it was already there but thanks to your 'before' and 'after' comparison.

    Again, thank you.
    Dreb

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic