v-scroll-affix

0.0.4 • Public • Published

v-scroll-affix

npm file size Build Status

A lightweight lib for making navigation elements affix as you scroll, a wrapper of scroll-affix .

在滚动时激活固钉的轻量级 vue 组件,封装自 scroll-affix

Live Demo

live demo

Installation

npm install v-scroll-affix --save

Usage

<div id="app" class="container">
    <div class="main">this is main content.</div>
    <div class="right-menu">
        <VScrollAffix :offsetTop="20" sectionSelector="#app .main">
            <ul>
                <li>this is a list</li>
                <li>this is a list</li>
                <li>this is a list</li>
                <li>this is a list</li>
                <li>this is a list</li>
                <li>this is a list</li>
            </ul>
        </VScrollAffix>
    </div>
</div>
// window
// const VScrollAffix = window['VScrollAffix'];
// commonjs like
// const VScrollAffix = require('v-scroll-affix');
// es module, typescript
import VScrollAffix from './VScrollAffix.vue';

// Vue.use(VScrollAffix); // global

export default {
    components: {
        VScrollAffix // local
    }
};

Props

name type default description
offsetTop number 0 offsetTop to affix element
浮动的 y 轴偏移量
maxScrollHeight number()=>number max height to affix element
自定义可浮动区域的最大高度
sectionSelector string get max height to affix element by section element
根据关联区域动态获取可浮动区域最大高度

Enjoy it! :D

Readme

Keywords

Package Sidebar

Install

npm i v-scroll-affix

Weekly Downloads

1

Version

0.0.4

License

MIT

Unpacked Size

8.93 kB

Total Files

4

Last publish

Collaborators

  • shalldie