(function () {
  'use strict';

  window.utils = window.utils || {};

  window.utils.stickynav = function (nav) {
    var ticking = false;

    init();
    function init() {
      window.addEventListener('scroll', function (e) {
        if (!ticking) {
          window.requestAnimationFrame(update);
          ticking = true;
        }
      }, false);
      update();
    }

    function update() {
      var sticky = window.scrollY > 30;
      nav.classList.toggle('navbar--sticky', sticky);
      ticking = false;
    }
  }

})();

document.addEventListener('setup', function (e) {
  // utils.stickynav(e.detail.scope.querySelector('.js-sticky-navbar'));
});
