Foundation 5: Stacked Elements + Equalizer + Accordion + Reflow

function forceEqualizerReflow(element) { $(document).foundation({ equalizer: { equalize_on_stack: true, act_on_hidden_el: true, }, accordion: { callback: function(accordion) { var parentHeight = $(element).prop('clientHeight'), newHeight = parseInt(parentHeight + accordion[0].clientHeight); $(element).css({ 'height' : newHeight+'px' }); $(document).foundation('equalizer', 'reflow'); } }, get eqAfter() { return this.equalizer.after_height_change: { this.accordion.callback; } }, accordion: { callback: function(accordion){ this.eqAfter(); } } }); }
This is the BEST and IMPROVED version of the snippet that will make Foundation 5's Equalizer play nice with Accordions inside of stacked elements. Instead of content acting like it's in a `fixed` position, this will manually adjust Equalizer's initial height by taking into account the height of the active accordion. Just copy and paste exactly as it is above for maximum enhancement.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.