'use strict';var_createClass=function(){functiona(b,c){for(vare,d=0;d<c.length;d++)e=c[d],e.enumerable=e.enumerable||!1,e.configurable=!0,'value'ine&&(e.writable=!0),Object.defineProperty(b,e.key,e)}returnfunction(b,c,d){returnc&&a(b.prototype,c),d&&a(b,d),b}}();function_classCallCheck(a,b){if(!(ainstanceofb))thrownewTypeError('Cannot call a class as a function')}varLazyLoad=function(){functiona(b){_classCallCheck(this,a),this.imglist=Array.from($(b)),this.init()}return_createClass(a,[{key:'canILoad',value:functioncanILoad(){for(varb=this.imglist,c=b.length;c--;)this.getBound(b[c])&&this.loadImage(b[c],c)}},{key:'getBound',value:functiongetBound(b){varc=b.getBoundingClientRect(),d=window.innerHeight;returnc.top<=d}},{key:'loadImage',value:functionloadImage(b,c){vard=b.getAttribute('data-original');b.src=d,this.imglist.splice(c,1)}},{key:'bindEvent',value:functionbindEvent(){varb=this;$(window).on('scroll',function(){returnb.imglist.length&&b.canILoad()}),$(window).on('resize',function(){returnb.imglist.length&&b.canILoad()})}},{key:'init',value:functioninit(){this.canILoad(),this.bindEvent()}}]),a}();