1
0
Fork 0
wmdeit_kaform/addons/visibility/kube.visibility.min.js

1 line
656 B
JavaScript
Raw Permalink Normal View History

2020-02-20 13:45:47 +00:00
!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);