/*! * headroom.js v0.12.0 - give your page some headroom. hide your header until you need it * copyright (c) 2020 nick williams - http://wicky.nillia.ms/headroom.js * license: mit */ !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).headroom=n()}(this,function(){"use strict";function t(){return"undefined"!=typeof window}function d(t){return function(t){return t&&t.document&&function(t){return 9===t.nodetype}(t.document)}(t)?function(t){var n=t.document,o=n.body,s=n.documentelement;return{scrollheight:function(){return math.max(o.scrollheight,s.scrollheight,o.offsetheight,s.offsetheight,o.clientheight,s.clientheight)},height:function(){return t.innerheight||s.clientheight||o.clientheight},scrolly:function(){return void 0!==t.pageyoffset?t.pageyoffset:(s||o.parentnode||o).scrolltop}}}(t):function(t){return{scrollheight:function(){return math.max(t.scrollheight,t.offsetheight,t.clientheight)},height:function(){return math.max(t.offsetheight,t.clientheight)},scrolly:function(){return t.scrolltop}}}(t)}function n(t,s,e){var n,o=function(){var n=!1;try{var t={get passive(){n=!0}};window.addeventlistener("test",t,t),window.removeeventlistener("test",t,t)}catch(t){n=!1}return n}(),i=!1,r=d(t),l=r.scrolly(),a={};function c(){var t=math.round(r.scrolly()),n=r.height(),o=r.scrollheight();a.scrolly=t,a.lastscrolly=l,a.direction=ls.tolerance[a.direction],e(a),l=t,i=!1}function h(){i||(i=!0,n=requestanimationframe(c))}var u=!!o&&{passive:!0,capture:!1};return t.addeventlistener("scroll",h,u),c(),{destroy:function(){cancelanimationframe(n),t.removeeventlistener("scroll",h,u)}}}function o(t){return t===object(t)?t:{down:t,up:t}}function s(t,n){n=n||{},object.assign(this,s.options,n),this.classes=object.assign({},s.options.classes,n.classes),this.elem=t,this.tolerance=o(this.tolerance),this.offset=o(this.offset),this.initialised=!1,this.frozen=!1}return s.prototype={constructor:s,init:function(){return s.cutsthemustard&&!this.initialised&&(this.addclass("initial"),this.initialised=!0,settimeout(function(t){t.scrolltracker=n(t.scroller,{offset:t.offset,tolerance:t.tolerance},t.update.bind(t))},100,this)),this},destroy:function(){this.initialised=!1,object.keys(this.classes).foreach(this.removeclass,this),this.scrolltracker.destroy()},unpin:function(){!this.hasclass("pinned")&&this.hasclass("unpinned")||(this.addclass("unpinned"),this.removeclass("pinned"),this.onunpin&&this.onunpin.call(this))},pin:function(){this.hasclass("unpinned")&&(this.addclass("pinned"),this.removeclass("unpinned"),this.onpin&&this.onpin.call(this))},freeze:function(){this.frozen=!0,this.addclass("frozen")},unfreeze:function(){this.frozen=!1,this.removeclass("frozen")},top:function(){this.hasclass("top")||(this.addclass("top"),this.removeclass("nottop"),this.ontop&&this.ontop.call(this))},nottop:function(){this.hasclass("nottop")||(this.addclass("nottop"),this.removeclass("top"),this.onnottop&&this.onnottop.call(this))},bottom:function(){this.hasclass("bottom")||(this.addclass("bottom"),this.removeclass("notbottom"),this.onbottom&&this.onbottom.call(this))},notbottom:function(){this.hasclass("notbottom")||(this.addclass("notbottom"),this.removeclass("bottom"),this.onnotbottom&&this.onnotbottom.call(this))},shouldunpin:function(t){return"down"===t.direction&&!t.top&&t.toleranceexceeded},shouldpin:function(t){return"up"===t.direction&&t.toleranceexceeded||t.top},addclass:function(t){this.elem.classlist.add.apply(this.elem.classlist,this.classes[t].split(" "))},removeclass:function(t){this.elem.classlist.remove.apply(this.elem.classlist,this.classes[t].split(" "))},hasclass:function(t){return this.classes[t].split(" ").every(function(t){return this.classlist.contains(t)},this.elem)},update:function(t){t.isoutofbounds||!0!==this.frozen&&(t.top?this.top():this.nottop(),t.bottom?this.bottom():this.notbottom(),this.shouldunpin(t)?this.unpin():this.shouldpin(t)&&this.pin())}},s.options={tolerance:{up:0,down:0},offset:0,scroller:t()?window:null,classes:{frozen:"headroom--frozen",pinned:"headroom--pinned",unpinned:"headroom--unpinned",top:"headroom--top",nottop:"headroom--not-top",bottom:"headroom--bottom",notbottom:"headroom--not-bottom",initial:"headroom"}},s.cutsthemustard=!!(t()&&function(){}.bind&&"classlist"in document.documentelement&&object.assign&&object.keys&&requestanimationframe),s});