Installations
npm install @foo-software/react-lazy-offscreen-image
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
10.15.0
NPM Version
6.4.1
Score
64.2
Supply Chain
92.8
Quality
75.5
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (95.2%)
CSS (4.8%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
foo-software
Download Statistics
Total Downloads
3,423
Last Day
1
Last Week
4
Last Month
45
Last Year
420
GitHub Statistics
36 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Jun 26, 2019
Bundle Size
9.74 kB
Minified
3.97 kB
Minified + Gzipped
Package Meta Information
Latest Version
0.0.17
Package Id
@foo-software/react-lazy-offscreen-image@0.0.17
Unpacked Size
20.43 kB
Size
7.97 kB
File Count
14
NPM Version
6.4.1
Node Version
10.15.0
Total Downloads
Cumulative downloads
Total Downloads
3,423
Last Day
0%
1
Compared to previous day
Last Week
0%
4
Compared to previous week
Last Month
12.5%
45
Compared to previous month
Last Year
-21.6%
420
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
@foo-software/react-lazy-offscreen-image
React Lazy Offscreen Image exports a lazy loading React component to display a background image when in the viewport and the image is loaded. When analyzing website performance with tools like Lighthouse for example, often we find an opportunity for improvement in loading images below the fold, on demand - asynchronously. Lighthouse documentation explains the offscreen image performance metric in detail. This component provides lazy loading of images as an element with a backround image, when the user has scrolled it into the browser viewport. This technique is known as "lazy loading".
Install
npm
npm install @foo-software/react-scroll-context @foo-software/react-lazy-offscreen-image
yarn
yarn add @foo-software/react-scroll-context @foo-software/react-lazy-offscreen-image
Dependencies
react@16.8
react-scroll-context
: Used to provide scroll data.
Props
Name | Description | PropType | Required | Default |
---|---|---|---|---|
children | Anything that can be rendered, but typically a tree of elements. The background image will be added to the container. children can optionally be specifid to render inside the container with the background image. | node | false | null |
className | An optional custom className to be added to the container. | string | false | null |
CustomTag | A custom HTML tag used for the container element. | string | false | div |
imageUrl | The image URL for the background image. | string | true | -- |
ScrollContext | A scroll Context object created by React.createContext() . You will need to use the same context as with react-scroll-context . This component depends on `react-scroll-context` to provide scroll data. | object | true | -- |
Usage
Example combined with react-scroll-context
.
1import React from 'react'; 2import { ScrollProvider } from '@foo-software/react-scroll-context'; 3import { LazyOffscreenImage } from '@foo-software/react-lazy-offscreen-image'; 4 5// replace `scroll-context` any name you like. 6const ScrollContext = React.createContext('scroll-context'); 7 8const App = () => ( 9 <ScrollProvider 10 Context={ScrollContext} 11 > 12 <div> 13 <h1>Scroll it!</h1> 14 <p>Ipsum lorem, a lot of content here...</p> 15 <LazyOffscreenImage 16 imageUrl="http://placekitten.com/300/300" 17 ScrollContext={ScrollContext} 18 /> 19 </div> 20 </ScrollProvider> 21);
Demo
An example using this component can be seen on Foo's features page.
Credits
This package was brought to you by Foo - a website performance monitoring tool. Create a free account with standard performance testing. Automatic website performance testing, uptime checks, charts showing performance metrics by day, month, and year. Foo also provides real time notifications when performance and uptime notifications when changes are detected. Users can integrate email, Slack and PagerDuty notifications.

No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
2.6
/10
Last Scanned on 2025-02-10
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