https://github.com/glorious-codes/glorious-fyzer
Listen when some element just appear above the browser's page fold
https://github.com/glorious-codes/glorious-fyzer
Last synced: about 1 year ago
JSON representation
Listen when some element just appear above the browser's page fold
- Host: GitHub
- URL: https://github.com/glorious-codes/glorious-fyzer
- Owner: glorious-codes
- License: mit
- Created: 2019-10-24T18:38:33.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-17T01:55:56.000Z (over 2 years ago)
- Last Synced: 2025-04-19T11:09:52.011Z (about 1 year ago)
- Language: JavaScript
- Homepage: https://glorious.codes/fyzer
- Size: 483 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Fyzer
> The easiest way to be notified when some element appears above the page fold
[](https://circleci.com/gh/glorious-codes/glorious-fyzer)
[](https://coveralls.io/github/glorious-codes/glorious-fyzer?branch=master)
## Installation
```
$ npm install -S @glorious/fyzer
```
## Usage
``` javascript
import fyzer from '@glorious/fyzer';
const element = document.querySelector('#myElement');
const subscriptionId = fyzer.subscribe(element, () => {
// This function will be called every time
// element appears above the fold.
});
// When you no longer needs to observe the element's position,
// you can unsubscribe from Fyzer:
fyzer.unsubscribe(subscriptionId);
```
## Contributing
1. Install [Node](https://nodejs.org/en/). Download the "Recommend for Most Users" version.
2. Clone the repo:
``` bash
git clone git@github.com:glorious-codes/glorious-fyzer.git
```
3. Go to the project directory:
``` bash
cd glorious-fyzer
```
4. Install the project dependencies:
``` bash
npm install
```
## Tests
Ensure that all code that you have added is covered with unit tests:
``` bash
npm run test -- --coverage
```