WordPress.org

Ready to get started?Download WordPress

Forums

Accordion Shortcode
Fixed accordions height ? (16 posts)

  1. Jean-no
    Member
    Posted 1 year ago #

    Since the last wordpress update (I think it came then), the accordions have a fixed size, and it has an ugly result : http://hyperbate.fr/homebook/index-des-menus/
    Is there a way to correct this ?

    http://wordpress.org/plugins/accordion-shortcode/

  2. AvalonMel
    Member
    Posted 1 year ago #

    I'm wondering the same thing. A client just got in touch to complain about it. For now I've just overridden the height:602px; with auto !important; in the CSS but this is a bit of a hack and seems to have done something weird with the performance.

  3. razoredger
    Member
    Posted 1 year ago #

    Thanks for the hack. I tried the autoheight function but it does nothing.

  4. danerich
    Member
    Posted 1 year ago #

    Same problem here. I have also used the auto!important fix but this has caused the animation to be really slow.

  5. eraser_tool
    Member
    Posted 1 year ago #

    Thanks, the hack worked.

  6. webstergroup
    Member
    Posted 1 year ago #

    The hack totally breaks the smooth scrolling. I can not figure out where the accordion is getting the fixed height from.

  7. fregad
    Member
    Posted 12 months ago #

    Same problem here.

    How did you override the CSS with auto!important?

    I can't figure out what class that controls it.

  8. Dan Hannigan
    Member
    Posted 11 months ago #

    Okay, I just posted a very ugly hack for this, but then I hopped in to the jQuery Accordion docs and found one simple line that did the trick.

    Please note this requires modifying the plugin itself, which I typically never condone, but it does the job and doesn't really futz with the plugin too much.

    In the plugin, starting on line 114 you'll find this code

    $query_atts = shortcode_atts( array(
    				'autoHeight'  => false,
    				'disabled'   => false,
    				'active'  => 0,
    				'animated'   => 'slide',
    				'clearStyle'  => false,
    				'collapsible'  => false,
    				'event'   => 'click',
    				'fillSpace'  => false
    			), $attr);

    What you're going to want to do is drop a new line in that shortcode_atts array that looks like this: 'heightStyle' => 'content'

    Don't forget to include a , on the previous line if you're adding. Here's my code below

    $query_atts = shortcode_atts( array(
    				'autoHeight'  => false,
    				'disabled'   => false,
    				'active'  => 0,
    				'animated'   => 'slide',
    				'clearStyle'  => false,
    				'collapsible'  => false,
    				'event'   => 'click',
    				'fillSpace'  => false,
    				'heightStyle' => 'content'
    			), $attr);

    Again, it's never ideal to modify the plugin like this, but it does work. If I can figure out how to properly integrate this in to where the user can set that variable I'll fork the plugin on GitHub and see if I can get the original developer to pull it in to their version.

  9. razoredger
    Member
    Posted 11 months ago #

    Great detective work dhannigan!

    I wonder what the thinking is behind the random id generator on page load.

    Thanks for sharing the hack. I too hate to hack a plugin because as we all know when the plugin gets an update the hack vanishs and we will be back to square one.

    Now wouldn't it be a dream if, in this scenario, we could create a "Child plugin", like for themes.

  10. Dan Hannigan
    Member
    Posted 11 months ago #

    My guess would be generating a random ID would help if you have multiple accordions on one page - resolves conflicting IDs. But, with the code above you shouldn't have to mess with the random ID :)

    I'm going to keep testing the plugin today, but it almost seems like users cant actually pass values to the accordion like it states you can. I'm not sure though.

  11. Kevin Phillips
    Member
    Posted 11 months ago #

    Dan Just to let you know that
    'heightStyle' => 'content'
    works 100%,
    I've created a copy of this plugin until this one is updated

    you can download it here
    http://kevinphillips.co.nz/news/wordpress-plugin-accordion-shortcode/

  12. edgarfigaro
    Member
    Posted 11 months ago #

    Awesome! Well done fellas with this addition. I just recognized that a fixed height was being applied to each accordion. In my instance, it was using the height of the first accordion. In other people's links, it wasn't always the first item's height.

    I'm gonna e-mail the plugin author. Hopefully he'll include this option in future updates.

  13. patrickd
    Member
    Posted 9 months ago #

    @webstergroup The fixed height is based on the height of the tallest content in your tabs.

    @dollar_dad Thanks for the great fix!

    To the authors: please update this plugin.

    Thanks.

  14. KLD
    Member
    Posted 9 months ago #

    dollar_dad thanks so much for this fix!

  15. lisa thirdside
    Member
    Posted 7 months ago #

    Thank you for the fix! Also, the reminder about the comma prior. I found this solution in another thread and couldn't figure out why it broke the plugin. Duh, I obviously need a break....

  16. Mickey Kay
    Member
    Posted 7 months ago #

    Plugin author: any chance we can get this issue fixed in the plugin?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic