该文档说了怎么在页面做图片预览, 一步一步的
}
},
//预览程序
_preview: function(data) {
//空值或相同的值不执行显示
if ( !!data && data !== this._data ) {
this._data = data; this._show();
}
},
//设置一般预载图片对象
_simplePreload: function() {
if ( !this._preload ) {
var preload = this._preload = new Image(), oThis = this,
onload = function(){ oThis._imgShow( oThis._data, this.width, this.height ); }; this._onload = function(){ this.onload = null; onload.call(this); }
preload.onload = $$B.ie ? this._onload : onload;
preload.onerror = function(){ oThis._error(); };
} else if ( $$B.ie ) {
this._preload.onload = this._onload;
}
},
//一般显示
_simpleShow: function() {
this._simplePreload();
this._preload.src = this._data;
},
//设置滤镜预载图片对象
_filterPreload: function() {
if ( !this._preload ) {
var preload = this._preload = document.createElement("div");
//隐藏并设置滤镜
$$D.setStyle( preload, {
width: "1px", height: "1px",
visibility: "hidden", position: "absolute", left: "-9999px", top: "-9999px", filter:
"progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='image')"
});
//插入body
var body = document.body; body.insertBefore( preload, body.childNodes[0] ); }
},