When using a newer version of jQuery UI than provided by core, the autoheight settings are not correctly applied. If the autoheight box is not checked, which would mean that accordion items should be the height of their content it needs the heightStyle option defined.

<script>
         $(function () {
             $("#accordion").accordion({
                 heightStyle: "content"
             });
         });
</script>

Comments

kevincrafts’s picture

Status: Active » Needs review
StatusFileSize
new694 bytes
omaster’s picture

Status: Needs review » Reviewed & tested by the community

I am not sure this is the best way to take this forward into the future. A better way would be allowing the user to change the heightStyle setting for newer versions of jquery but as it is this does address the issue and until someone really needs the third option available using heightstyle this will fix the important issue

omaster’s picture

Actually I forgot to say there is one typo in it. autoHeight should be all lower case autoheight.

Have added a file that has this change.

alexiscott’s picture

#3 works a charm. Tested on version = "7.x-3.6"

lquessenberry’s picture

i am getting the following error and I am not sure why.

Notice: Undefined index: autoheight in QuickAccordion->add_attached() (line 67 of /var/www/public/sites/all/modules/contrib/quicktabs/plugins/QuickAccordion.inc).

Other than that it seems to work properly.

lquessenberry’s picture

I ended up stripping the IF statement to force it to work without throwing error. If it helps I am using jQuery update and 1.10 version. I hope there's a better fix for this down the road. I patched both the dev and stable releases and had the same error message.

santiwww’s picture

I had the same notice of undefined index, and the problem is that there is no typo in the first patch as omaster points out, the jQuery UI setting has the property "autoHeight" not in lowercase so the patch #1 made by kevincrafts is the correct one.

JimJS’s picture

I changed the patch to check isset and the undefined index error stopped.

if (!isset($settings['options']['jquery_ui']['autoheight'])) {

stefan.korn’s picture

Stumbled across the same problem with Jquery Update.

Patch given in #3 sets the heightStyle option regardless what Jquery UI is used. Since Jquery UI 1.8 and lower do not support heightStyle (and that is the default in D7) the option heightStyle should probably not be set, even if it does not have any side effects.

So I have done another patch which adds an option heightStyle to the configuration of the Accordion. Here we can choose to not use heightStyle (for Jquery UI 1.8 and lower) or to use one of the options for heightStyle (auto, fill or content). If heightStyle option other than "don't use" is chosen the autoHeight option will be removed in the Javascript, since it is replaced by heightStyle in newer Jquery Versions.

So I think this is a cleaner JS code, since only one option, either autoHeight or heightStyle, will be set.

stefan.korn’s picture

Status: Reviewed & tested by the community » Needs review

Status: Needs review » Needs work

The last submitted patch, 9: 2534684-quicktab-accordion-autoheight-jqueryui-009.patch, failed testing.

stefan.korn’s picture

stefan.korn’s picture

Status: Needs work » Needs review
afsch’s picture

The patch in Comment #3 works just in some cases. The condition (line 67) throws an error when the 'autoheight' is undefined. I just improved a bit that condition.

Status: Needs review » Needs work

The last submitted patch, 14: 2534684-quicktab-accordion-autoheight-jqueryui-014.patch, failed testing.

afsch’s picture

StatusFileSize
new701 bytes
millionleaves’s picture

The patch in #16 did the trick for me - thanks.

kienan’s picture

Status: Needs work » Reviewed & tested by the community

Patch in #16 also worked for me.

bensey’s picture

#16 worked for me also...
Thanks.
Commit, commit!

nwom’s picture

Version: 7.x-3.6 » 7.x-3.x-dev

This applied cleanly and worked against the newest dev. Thank you for your work! It also fixed the problem where the views titles were not displaying.

tutorb’s picture

Number 16 worked for me...
Thanks to Alexito!

  • systemick committed f6fb0fe on 7.x-3.x authored by alexito
    Issue #2534684 by kevincrafts: Quicktab Accordion Autoheight setting not...
systemick’s picture

Committed into the dev branch. This will be in the next release.

systemick’s picture

Status: Reviewed & tested by the community » Fixed
systemick’s picture

Status: Fixed » Closed (fixed)