• Stars
    star
    167
  • Rank 226,635 (Top 5 %)
  • Language Vue
  • License
    MIT License
  • Created almost 7 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

Vue Fixed Header

code style: prettier License: MIT NPM version All Contributors NPM downloads codecov

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>
    <div class="navbar">
      Your Content
    </div>
  </fixed-header>
</template>

<script>
import FixedHeader from 'vue-fixed-header'

export default {
  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 the vue-fixed-header CSS class to the slot's root element. Also, when matching the fixed condition, we give the vue-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">
    <div class="navbar">
      Your Content
    </div>
  </fixed-header>
</template>

<script>
import FixedHeader from 'vue-fixed-header'

export default {
  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 the all-contributors specification. Contributions of any kind welcome!

More Repositories

1

nuxt-firebase-sns-example

Nuxt v2 & Firebase(Hosting / Functions SSR / Firestore), Google Auth SNS Example.
Vue
483
star
2

nuxt-basic-auth-module

Provide basic auth your Nuxt.js application
JavaScript
310
star
3

nuxt-client-init-module

Provide client version of nuxtServerInit
JavaScript
236
star
4

nuxt-beginners-guide

Japan's first book that corresponds to Nuxt.js v2 and focuses on deep content.
Vue
135
star
5

pokemon63

ใ€Œใฟใ‚“ใชใฎ63 - ใ‚นใ‚ฏใƒชใƒผใƒณใ‚ทใƒงใƒƒใƒˆใ‹ใ‚‰่‡ชๅ‹•่งฃๆžใงใใ‚‹ใƒใ‚ฑใƒขใƒณใฎ้ธๅ‡บๆŠ•็จฟใ‚ตใ‚คใƒˆใ€ใฎใ‚ฝใƒผใ‚นใ‚ณใƒผใƒ‰
TypeScript
108
star
6

nuxt-maintenance-mode

Maintenance mode module for Nuxt.js.
TypeScript
107
star
7

dodai

Static Site Generator
TypeScript
59
star
8

contributter

Evergreen for you.
TypeScript
56
star
9

how-to-safety-env-use-in-nuxt

Safe env vars handling sample by Nuxt.js project
Vue
36
star
10

parcel-examples

Parcel project examples for React, Vue, preact, VanillaJS and jQuery.
JavaScript
27
star
11

potato4d

22
star
12

vue-dev-template

[deprecated] Vue.js development template.
Vue
22
star
13

nuxt-and-wp-api-on-docker

Vue
20
star
14

docker-multi-stage-build-on-nuxt

Vue
20
star
15

kamishibai-viewer

Qiita slide mode embed library
Vue
19
star
16

yomu

The README explorer for node_modules.
TypeScript
15
star
17

rehype-plugin-image-native-lazy-loading

Native lazy loading plugin for Rehype
TypeScript
15
star
18

vite-template-vue3-library

TypeScript
14
star
19

nuxt-tech-book

Nuxt tech book support document
12
star
20

vuex-map-purge

Convert Vuex map utils to computed / methods.
TypeScript
11
star
21

potato4d.me

potato4d's website
HTML
10
star
22

minimalytm-website

minimalytm official Website
Vue
9
star
23

sentei

CLI Git branch cleaner built with Node.js
TypeScript
9
star
24

huniki_generator

ใ€Œใœใ‚“ใœใ‚“ใ‚ใ‹ใ‚‰ใชใ„ใ€ไฟบ้”ใฏ้›ฐๅ›ฒๆฐ—ใงใ‚ฎใƒ•ใƒใƒ–ใ‚’ใ‚„ใฃใฆใ„ใ‚‹ใ€
HTML
7
star
25

techfeed-share-button

The social share button for TechFeed
TypeScript
7
star
26

vue-next-tsx-only-tsc

HTML
6
star
27

nuxt_html5expertsjp

Vue
6
star
28

qiita-feed-generator

Private feed generator for Qiita.
TypeScript
6
star
29

minimalytm

Minimal YouTube Music Player built with Electron
TypeScript
6
star
30

rehype-plugin-auto-resolve-layout-shift

Flexible improve CLS plugin for rehype.
TypeScript
6
star
31

react-muted-video-player

TypeScript
6
star
32

nuxt-typescript-with-grpc-web

[WIP] Nuxt.js application development environment using gRPC Web and TypeScript
JavaScript
6
star
33

sublime-HSP

This is the Sublime Text HSP syntax package.
5
star
34

bk-slack-to-gh-issue

Slack Message send to Github Issue Using Botkit.
JavaScript
4
star
35

liff-screenshot-plugin

ScreenShot plugin for LIFF
TypeScript
4
star
36

unlinkable

The easiest way to unlink an @mention.
Vue
4
star
37

to-webp

TypeScript
3
star
38

ytm-share-proxy

OGP Proxy for YouTube Music
HTML
3
star
39

renovate-config

3
star
40

riot-wp-api

Riot.js with WP REST API Sample for WordCamp Kansai 2016. Please fork me and use hands-on!
JavaScript
3
star
41

node-connpass

The connpass API wrapper library for Node.js.
TypeScript
3
star
42

iso8601

HTML
2
star
43

dotfiles

My dotfiles.
Shell
1
star