Simple and cross-browser friendly fixed header component for Vue.js.
yarn add vue-fixed-header
<template>
<fixed-header :fixed.sync="isFixed">
<div :class="{ 'is-fixed': isFixed }">
Your Content
</div>
</fixed-header>
</template>
<script>
import FixedHeader from 'vue-fixed-header'
export default {
components: {
FixedHeader
},
data () {
return {
isFixed: false
}
}
}
</script>
The threshold value for determining the scroll state.
<template>
<fixed-header :fixed.sync="isFixed" :threshold="100">
<div :class="{ 'is-fixed': isFixed }">
Your Content
</div>
</fixed-header>
</template>
<script>
import FixedHeader from 'vue-fixed-header'
export default {
components: {
FixedHeader
},
data () {
return {
isFixed: false
}
}
}
</script>
MIT © potato4d
Thanks goes to these wonderful people (emoji key):
HANATANI Takuma 💻 🐛 📖 💡 💬 👀 |
EGOIST 🔧 |
Johnny Cavalcante 🐛 |
James Wright 🐛 |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!