FixedHeader using automatic offsets with multiple fixed elements

FixedHeader using automatic offsets with multiple fixed elements

Wooly65Wooly65 Posts: 61Questions: 17Answers: 0

I have multiple fixed header elements (navigation bar and a dc.js data count/filter information bar). Obviously I could provide a hardcode numeric offset or named elements:
headerOffset: 87
headerOffset: $('#navMenu').outerHeight() + $('#dcDataCount').outerHeight()

But I like the idea of letting FixedHeader find the elements with the assigned class "fh-fixedHeader", but line 225 will only process the first element:
var autoHeader = $('.fh-fixedHeader');
if ( ! this.c.headerOffset && autoHeader.length ) {
this.c.headerOffset = autoHeader.outerHeight();
}

I would suggest the following to process multiple fixed header elements:
var autoHeader = $('.fh-fixedHeader');
if ( ! this.c.headerOffset && autoHeader.length ) {
autoHeader.each(function () {that.c.headerOffset += $(this).outerHeight()});
}

and to complete the code it should also be applied to the fixed footer elements:
var autoFooter = $('.fh-fixedFooter');
if ( ! this.c.footerOffset && autoFooter.length ) {
autoFooter.each(function () {that.c.footerOffset += $(this).outerHeight()});
}

This discussion has been closed.