{"id":16601755,"url":"https://github.com/biyuqi/lazyloading-img","last_synced_at":"2026-04-19T17:38:50.804Z","repository":{"id":96719283,"uuid":"83525203","full_name":"BiYuqi/lazyloading-img","owner":"BiYuqi","description":"DIY的图片懒加载插件节流优化版, 具体效果可以看右侧链接demo","archived":false,"fork":false,"pushed_at":"2017-06-07T06:21:47.000Z","size":10231,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-17T07:44:40.816Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://loadingmore.com/demo/src/html/lazyload.html","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BiYuqi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-01T07:26:00.000Z","updated_at":"2021-06-29T06:31:08.000Z","dependencies_parsed_at":"2024-02-21T21:46:50.895Z","dependency_job_id":null,"html_url":"https://github.com/BiYuqi/lazyloading-img","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BiYuqi%2Flazyloading-img","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BiYuqi%2Flazyloading-img/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BiYuqi%2Flazyloading-img/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BiYuqi%2Flazyloading-img/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BiYuqi","download_url":"https://codeload.github.com/BiYuqi/lazyloading-img/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242650955,"owners_count":20163611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T00:19:11.605Z","updated_at":"2025-12-05T17:02:01.790Z","avatar_url":"https://github.com/BiYuqi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 为什么要实现图片懒加载?\n对于一般页面，影响速度最大的因素可能就是图片的大小了，一张普通的图片小道几百k,达到上M,页面图片很多时，页面的加载速度缓慢，几S钟内页面没有加载完成，也许会失去很多的用户。所以，对于图片过多的页面，为了加速页面加载速度，所以很多时候我们需要将页面内未出现在可视区域内的图片先不做加载， 等到滚动到可视区域后再去加载。这样子对于页面加载性能上会有很大的提升，也提高了用户体验。\n\n### 原理\n将页面中的img标签src指向一张小图片或者src为空，然后定义data-src（这个属性可以自定义命名，默认用data-src）属性指向真实的图片。src指向一张默认的图片(即本文的default.png)，否则当src为空时也会向服务器发送一次请求。可以指向loading的地址。\n\n### 直接上用法demo，文章博客会详细讲解\n```javascript\ngit clone https://github.com/BiYuqi/lazyloading-img.git\n\ncd lazyloading-img //进入文件夹\n\n//demo 为测试文件\n//lazyloading-img.js 懒加载插件 不借助第三方库 纯原生js\n\n```\n### 自己使用时的方法\n```javascript\n//页面引入 lazyloading-img.js\n//使用方法\n$lazyload({\n    img:'img',//图片即标签名 默认写img\n    timer:'0.4s'//淡入淡出时间\n});\n\n//至此可以去看看网页中的效果了 注意img 必须给定高度\n```\n![](img/lazy.gif)\n### 说明\n本插件只提供图片懒加载 ,图片淡入淡出功能，暂无其他\n如有问题，请联系我biyuqiwan@163.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiyuqi%2Flazyloading-img","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiyuqi%2Flazyloading-img","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiyuqi%2Flazyloading-img/lists"}