图片load事件

在写网页时常常遇到一些在图片加载后再开始某些需求的情况,一下是兼容性的在图片加载成功之后进行回调的代码:

<script>
function loadImage (url,callback,data) {
	var img = new Image();
	img.onload = function () {
		img.onload = null;
		callback.call(img,data);
	}
	img.src = url;
	if (img.complete) {
		callback.call(img,data);
		return;
	}
}
</script>
此条目发表在NodeJs分类目录,贴了标签。将固定链接加入收藏夹。

4 则回应给 图片load事件

  1. domain name for sale说:

    This 356688.com domain name is for sale.

    If you would like, please email:

    sdzfd@hotmail.com

  2. site web说:

    I just want to mention I am new to blogs and really savored this web blog. Likely I’m want to bookmark your blog post . You certainly come with exceptional articles and reviews. Many thanks for revealing your website page.

    • 博主说:

      Thank for your approval and encouragement! I share some of my views just want to grow up with others on the front-end. So welcome to leave your advice and criticisms. ^_^

  3. Frank说:

    Ahaa, itss pleasant conversatjon about this pokst here aat thi webb site, I havve rad aall
    that, so att this time mee als commenting here.

    I aam sute his paragrwph haas tuched all tthe intednet
    people, iits really really nce paragraph oon building uup nnew blog.
    I really lik what you guy aare usually uup too.
    Such cloever ork aand reporting! Keeep upp thee sulerb wworks guys I’ve incorporated yyou guys too our blogroll.
    http://cspan.co.uk

site web进行回复 取消回复

电子邮件地址不会被公开。 必填项已用*标注