Skip to content

Instantly share code, notes, and snippets.

@mattd
Last active December 11, 2015 14:08
Show Gist options
  • Save mattd/4611792 to your computer and use it in GitHub Desktop.
Save mattd/4611792 to your computer and use it in GitHub Desktop.
define([
'jquery',
'underscore'
], function ($, _) {
"use strict";
return {
onRender: function () {
var column = this.$el.parents('.column');
var debounceResize = _.debounce(this.resize, 100);
$(window).resize(_.bind(debounceResize, this));
$(window).trigger('resize');
},
onClose: function () {
$(window).unbind('resize');
},
resize: function () {
var column = this.$el.parents('.column');
var viewTop = this.$el.position().top;
var tertiaryNavTop = column.find('.tertiary').position().top;
var adjustedHeight = tertiaryNavTop - viewTop;
this.$el.height(adjustedHeight);
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment