This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/lib/offset-calculator.js.es6
2016-05-31 10:51:39 -04:00

9 lines
358 B
JavaScript

export default function offsetCalculator() {
const $header = $('header');
const $title = $('#topic-title');
const windowHeight = $(window).height() - $title.height();
const expectedOffset = $title.height() - $header.find('.contents').height() + (windowHeight / 5);
return $header.outerHeight(true) + ((expectedOffset < 0) ? 0 : expectedOffset);
}