jQuery图片预加载

来源:https://www.sucaihuo.com/js/2163.html 2017-06-14 06:57浏览(631) 收藏

jQuery图片预加载,jQuery实现图片预加载效果,提高用户体验
jQuery图片预加载
分类:图片代码 > 延迟加载 难易:中级
查看演示 下载资源 下载积分: 40 积分
$.each(images,function (i,src) {
        var imgObj = new Image();

        $(imgObj).on("load error",function () {
            preload.html(Math.round((count+1)/len*100)+"%");
            $("#progress").attr("value",Math.round((count+1)/len*100));
            if(count>=len-1){
               loading.hide();
            }
            count++;
        });

        imgObj.src=src;
    });
标签: 加载预加载
评论0
头像

系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791

1 2