移动端用canvas代替img渲染图片,可以提高性能
var oImg = new Image();
oImg.src = url;
oImg.onload = function(){
var cvs = $('#cvsIndex')[0].getContext('2d');
cvs.width = this.width;
cvs.width = this.height;
cvs.drawImage(this,0,0);
}
2024-02-06 16:57:28
移动端用canvas代替img渲染图片,可以提高性能
var oImg = new Image();
oImg.src = url;
oImg.onload = function(){
var cvs = $('#cvsIndex')[0].getContext('2d');
cvs.width = this.width;
cvs.width = this.height;
cvs.drawImage(this,0,0);
}