Vue 3 sidebar component that sticks to top or bottom of the screen when page scrolls, based on scroll direction.
yarn add vue-smart-sticky-sidebar
Import SmartStickySidebar
component in script section of SFC:
import { SmartStickySidebar } from 'vue-smart-sticky-sidebar'
Then in template section:
<!-- element with display: flex -->
<div class="wrapper">
<SmartStickySidebar>
<!-- sidebar content here -->
</SmartStickySidebar>
<main class="content">
<!-- main content there -->
</main>
</div>
type: any
default: ''
Accepts any valid expression for outer (static) element's :class
attribute
type: any
default: ''
Accepts any valid expression for inner (moving) element's :class
attribute
type: number
default: 0
Distance in pixels between sidebar content sticked to the top and window top
type: number
default: 0
Distance in pixels between sidebar content sticked to the bottom and window bottom
Run in dev mode:
yarn dev
Open link from console in browser to see Playground
Basic component functionalityBasic dev plaugroundBuild as a libThis readme- Implement testing
- Improve dev playground
- New features
- disabling sticky behavior
- emit events, expose state
- ???
ubzor (c) 2024