define(["jquery","underscore"],function(e,t){var n,r;return r={container:window,threshold:.75,autofill:!1,resize:!0,trigger:null},n=function(n,r){var i=this;return this.element=e(n),this.options=r,this.container=e(r.container),r.resize&&e(window).on("resize",t.debounce(function(){return i.reset()},100)),this.container.on("scroll",t.debounce(function(){var e,t;e=i.container.scrollTop(),t=(i.element.height()-i.container.height())*i.options.threshold;if(!i.reached&&e>=t)return i.reached=!0,i.element.trigger("scroller")},100)),r.trigger&&this.element.on("scroller",r.trigger),this},n.prototype={constructor:n,reset:function(){return this.reached=!1,this.options.autofill&&this.element.height()-this.container.height()<0&&this.element.trigger("scroller"),this}},e.fn.scroller=function(t){var i;return e.isPlainObject(t)?i=e.extend({},r,t):i=e.extend({},r),this.each(function(){var r,s;r=e(this),s=r.data("scroller"),s||(s=new n(r,i),r.data("scroller",s),s.reset());if(typeof t=="string")return s[t]()})},e.fn.scroller.Constructor=n});