You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1 lines
656 B

!function(i){i.add("module","visibility",{init:function(i,t){this.app=i,this.$win=i.$win;var s={tolerance:15};this.context=t,this.params=t.getParams(s),this.$element=t.getElement()},start:function(){this.$win.on("scroll.kube.visibility resize.kube.visibility",this._check.bind(this)),this._check()},stop:function(){this.$win.off(".kube.visibility")},_check:function(){var i=this.$win.scrollTop(),t=i+this.$win.height(),s=this.$element.offset().top,e=s+this.$element.height(),n=e>=i&&t>=s&&e<=t+this.params.tolerance&&s>=i;n?this.app.broadcast("visibility.visible",this,this.$element):this.app.broadcast("visibility.invisible",this,this.$element)}})}(Kube);