# scrollinout

> vue directive scroll in or out

Latest version **1.0.4** (published 2019-02-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install scrollinout
pnpm add scrollinout
yarn add scrollinout
bun add scrollinout
```

## 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.0.4 |
| Published | 2019-02-18 |
| First published | 2019-02-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | soberz |
| Maintainers | soberz |
| Keywords | vue, directive, lazy load, scroll, scrollinout |

## Links

- npm: https://www.npmjs.com/package/scrollinout
- Repository: https://github.com/YSMJ1994/scrollinout
- Issues: https://github.com/YSMJ1994/scrollinout/issues
- npm.io page: https://npm.io/package/scrollinout

## Recent versions

- 1.0.4 (latest) — 2019-02-18
- 1.0.3 — 2019-02-16
- 1.0.2 — 2019-02-16
- 1.0.1 — 2019-02-16
- 1.0.0 — 2019-02-16

## README

# scrollinout [![npm](https://img.shields.io/npm/v/scrollinout.svg)](https://www.npmjs.com/package/scrollinout) [![npm](https://img.shields.io/npm/dm/scrollinout.svg)](https://www.npmjs.com/package/scrollinout) [![npm](https://img.shields.io/npm/l/scrollinout.svg)](LICENSE)

## Installation

```bash
npm i scrollinout -S
```

## Usage

Vue directive

### install

```js
import scrollInOut from 'scrollinout'
import Vue from 'vue'

Vue.use(scrollInOut)
```

### use in .vue

```html
<template>
    <!-- 参数为dom实体的判定面积(默认[20%,100%])，如下面 [0%,100%] 代表dom面积为整个dom的高宽，
    面积只要有一点出现在视野范围内或离开视野范围则调用传入的函数，目前只支持传入函数。 -->
    <!-- 绑定节点需要有固定宽高，如果自适应内容高度，如下的写法则会缺少占位空间 -->
    <div style="height: 30px" v-scroll-in-out:[0%,100%]="stateChange">
        <span v-if="show">{{message}}</span>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                show: false,
                message: 'message'
            }
        },
        methods: {
            stateChange(isIn) {
                if(isIn) {
                    // component scroll in view
                    this.show = true
                } else {
                    // component scroll out of view
                    this.show = false
                }
            }
        }
    }
</script>
```

## License

MIT. Copyright (c) [SoberZ](https://www.soberz.cn).

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