Gathering detailed insights and metrics for lazy-load-img
Gathering detailed insights and metrics for lazy-load-img
Gathering detailed insights and metrics for lazy-load-img
Gathering detailed insights and metrics for lazy-load-img
npm install lazy-load-img
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
365 Stars
95 Commits
134 Forks
22 Watchers
1 Branches
1 Contributors
Updated on Nov 27, 2024
Latest Version
3.0.8
Package Id
lazy-load-img@3.0.8
Unpacked Size
128.44 kB
Size
34.66 kB
File Count
12
NPM Version
6.4.1
Node Version
8.11.2
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
npm install lazy-load-img --save
1.原生js开发,不依赖任何框架或库
2.支持将各种宽高不一致的图片,自动剪切成默认图片的宽高
比如说你的默认图片是一张正方形的图片,则各种宽度高度不一样的图片,自动剪切成正方形。
完美解决移动端开发中,用户上传图片宽高不一致而导致的图片变形的问题
3.简洁的API,让你分分钟入门!!!
1 var lazyLoadImg = new LazyLoadImg({ 2 el: document.querySelector('#list'), 3 mode: 'default', //默认模式,将显示原图,diy模式,将自定义剪切,默认剪切居中部分 4 time: 300, // 设置一个检测时间间隔 5 done: true, //页面内所有数据图片加载完成后,是否自己销毁程序,true默认销毁,false不销毁 6 position: { // 只要其中一个位置符合条件,都会触发加载机制 7 top: 0, // 元素距离顶部 8 right: 0, // 元素距离右边 9 bottom: 0, // 元素距离下面 10 left: 0 // 元素距离左边 11 }, 12 before: function () { 13 14 }, 15 success: function (el) { 16 el.classList.add('success') 17 }, 18 error: function (el) { 19 el.src = './images/error.png' 20 } 21 }) 22 23 // lazyLoadImg.start() // 重新开启懒加载程序 24 // lazyLoadImg.destroy() // 销毁图片懒加载程序
1 var lazyLoadImg = new LazyLoadImg({ 2 el: document.querySelector('#list'), 3 mode: 'diy', //默认模式,将显示原图,diy模式,将自定义剪切,默认剪切居中部分 4 time: 300, // 设置一个检测时间间隔 5 done: true, //页面内所有数据图片加载完成后,是否自己销毁程序,true默认销毁,false不销毁 6 position: { // 只要其中一个位置符合条件,都会触发加载机制 7 top: 0, // 元素距离顶部 8 right: 0, // 元素距离右边 9 bottom: 0, // 元素距离下面 10 left: 0 // 元素距离左边 11 }, 12 diy: { //设置图片剪切规则,diy模式时才有效果 13 backgroundSize: 'cover', 14 backgroundRepeat: 'no-repeat', 15 backgroundPosition: 'center center' 16 }, 17 before: function () { 18 19 }, 20 success: function (el) { 21 el.classList.add('success') 22 }, 23 error: function (el) { 24 el.src = './images/error.png' 25 } 26 }) 27 28 // lazyLoadImg.start() // 重新开启懒加载程序 29 // lazyLoadImg.destroy() // 销毁图片懒加载程序
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/27 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
42 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More