# scroll-limits

> Note: Jquery needed

Latest version **1.1.0** (published 2020-01-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install scroll-limits
pnpm add scroll-limits
yarn add scroll-limits
bun add scroll-limits
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2020-01-28 |
| First published | 2019-11-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Rockdrizt |
| Maintainers | rockdrizt |
| Keywords | scroll |

## Links

- npm: https://www.npmjs.com/package/scroll-limits
- Repository: https://github.com/Rockdrizt/scroll-limits
- Homepage: https://github.com/Rockdrizt/scroll-limits#readme
- Issues: https://github.com/Rockdrizt/scroll-limits/issues
- npm.io page: https://npm.io/package/scroll-limits

## Recent versions

- 1.1.0 (latest) — 2020-01-28
- 1.0.1 — 2019-11-15
- 1.0.0 — 2019-11-15

## README

# scroll-limits

### Detect when a scroll  element reaches its limit
Note: Jquery needed

# Install
`npm install scroll-limits`

# Use
```javascript
  // import module
  import scrollLimits from 'scroll-limits';
  
  //OPTIONS
  let options = {
    /*
      Element to detect scroll behavior. 
      It could be id, class, tag or any Jquery selector. 
      It takes the first element if there is more than one
    */
    element: String,
    /*
      Fuction invoqued when the scroll reach the top or bottom limit.
      Returns the limit as a string 'top', 'bottom' or 'v_center
    */
    vertical: Function,
    /*
      Fuction invoqued when the scroll reach the left or right limit.
      Returns the limit as a string 'left', 'right' or 'h_center'
    */
    horizontal: Function
  }
  
  //execute detecLimit function passing the options parameter
  scrollLimits.detectLimit(options)
```

# Example
```javascript
  import scrollLimits from 'scroll-limits';
  
  scrollLimits.detectLimit({
    element: '#element-to-scroll',
    vertical: function (limit) {
      console.log(limit) // 'top', 'bottom' or 'v_center'
    },
    horizontal: function (limit) {
      console.log(limit) // 'left', 'right' or 'h_center'
    },
  })
  
  scrollLimits.detectLimit({
    element: '.elements', // detect the behavior of the first element found
    vertical: (limit) => { console.log(limit) }, // 'top', 'bottom' or 'v_center'
    horizontal: (limit) => { console.log(limit) }, // 'left', 'right' or 'h_center'
  })
```

---
_Source: https://npm.io/package/scroll-limits · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
