function lazyload(className) {
var obj = this;
lazyload.className = className;
console.log(this);
console.log(lazyload);
this.getOffset = function (el, isLeft) {
var retValue = 0 ;
...
return retValue;
};
this.initImages = function (ele) {
...
};
this.showImage = function() {
this.initImages();
...
return true;
};
this.initImages();
_attachEvent(window, 'scroll', function(){obj.showImage();});
new lazyload();
看到这样一段代码,
用console打印出lazyload和this变量,一个是返回的函数定义,一个是对象引用,不明白为什么,求解,可以将函数体内的lazyload替换为this吗?
慕斯王
相关分类