Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Simple and cross-browser friendly fixed header component for Vue.js written by TypeScript.

License

NotificationsYou must be signed in to change notification settings

potato4d/vue-fixed-header

Repository files navigation

code style: prettierLicense: MITNPM versionAll ContributorsNPM downloadscodecov

Simple and cross-browser friendly fixed header component for Vue.js.

Image from Gyazo

Edit vue-fixed-header demo

Install

yarn add vue-fixed-header

Usage

Use in Single File Component

<template><fixed-header><divclass="navbar">      Your Content</div></fixed-header></template><script>importFixedHeaderfrom'vue-fixed-header'exportdefault{components:{    FixedHeader}}</script><style>.navbar.vue-fixed-header--isFixed {position: fixed;left:0;top:0;width:100vw;}</style>

Attach classes

The Vue Fixed Header always assigns thevue-fixed-header CSS class to the slot's root element.Also, when matching the fixed condition, we give thevue-fixed-header--isFixed CSS class.These can also be changed with headerClass prop and fixedClass prop.

Props

threshold: number

The threshold value for determining the scroll state.

<template><fixed-header:threshold="100"><divclass="navbar">      Your Content</div></fixed-header></template><script>importFixedHeaderfrom'vue-fixed-header'exportdefault{components:{    FixedHeader}}</script><style>.navbar.vue-fixed-header--isFixed {position: fixed;left:0;top:0;width:100vw;}</style>

headerClass

CSS class for fixed-header root Element.It is always attached to fixed header root Element.

  • type: String,
  • required: false
  • default: 'vue-fixed-header'

fixedClass

CSS class for fixed header.When fixed-header position is relative, it removed to DOM Element.When fixed-header position is fixed, it added to DOM Element.

  • type: String
  • required: false
  • default: 'vue-fixed-header--isFixed'

License

MIT ©potato4d

Contributors

Thanks goes to these wonderful people (emoji key):


HANATANI Takuma

💻🐛📖💡💬👀

EGOIST

🔧

Johnny Cavalcante

🐛

James Wright

🐛

Sid

⚠️

André Van Dal

💻

Patrik

🐛

This project follows theall-contributors specification. Contributions of any kind welcome!

About

Simple and cross-browser friendly fixed header component for Vue.js written by TypeScript.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp