{"size": 606, "ext": "js", "max_stars_repo_path": "source/javascripts/layouts/header.js", "max_stars_repo_name": "alexanderalmstrom/contentful-middleman", "max_stars_repo_stars_event_min_datetime": "2018-02-07T14:10:59.000Z", "max_stars_repo_stars_event_max_datetime": "2018-02-07T14:10:59.000Z", "max_issues_repo_path": "source/javascripts/layouts/header.js", "max_issues_repo_name": "alexanderalmstrom/contentful-middleman", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "source/javascripts/layouts/header.js", "max_forks_repo_name": "alexanderalmstrom/contentful-middleman", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.5483870968, "max_line_length": 99, "alphanum_fraction": 0.5940594059}
//
// header.js
//

const Header = (($) => {
  const Selector = {
    HTML: $('html'),
    BODY: $('body'),
    HEADER: $('#header'),
    POST_HEADER: $('.post-header-container')
  }

  let currentScroll = 0

  $(window).on('scroll', function () {
    currentScroll = $(window).scrollTop()

    if (!Selector.BODY.hasClass('single'))
      return

    if (currentScroll > Selector.POST_HEADER.outerHeight() - (Selector.HEADER.outerHeight() / 2)) {
      Selector.HTML.addClass('state--scrolled')
    } else {
      Selector.HTML.removeClass('state--scrolled')
    }
  })

})(jQuery)

export default Header
