[JS]Load pictures lasily

2019-3-23 写技术

  /* Load pictures lasily. */
  $("img.data_lazy").each(function(){
  	var id = $(this);
  	var data = $(this).attr("data_lazy");
	var img = new Image();
	img.src = data;
	img.onload = function(){
		img.onload = null;
		id.attr("src", data);
	}
  });

标签: JS

发表评论:

Powered by anycle 湘ICP备15001973号