Skip to content

Commit e8ae474

Browse files
committed
add readme shields, edit index html, pkg json
1 parent c0105ad commit e8ae474

File tree

5 files changed

+21
-19
lines changed

5 files changed

+21
-19
lines changed

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
![npm](https://img.shields.io/npm/v/vue-use-active-scroll?color=46c119) ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/smastrom/vue-use-active-scroll/tests.yml?branch=main&label=tests)
2+
![dependency-count](https://img.shields.io/badge/dependency%20count-0-success)
3+
14
# Vue Use Active Scroll
25

3-
**Examples:** Vite: [Demo App]() — Nuxt Content: [Nested TOC](https://stackblitz.com/edit/github-oh85gq?file=components%2FSidebar.vue)
6+
**Examples:** Vite: [Demo App](https://vue-use-active-scroll.netlify.app) — Nuxt Content: [Nested TOC](https://stackblitz.com/edit/github-oh85gq?file=components%2FSidebar.vue)
47

58
:bulb: Requires Vue 3 or above.
69

@@ -153,15 +156,15 @@ const { isActive, setActive } = useActive(targets, {
153156
})
154157
```
155158

156-
| Property | Type | Default | Description |
157-
| -------------- | ------------------ | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
158-
| jumpToFirst | `boolean` | true | Whether to set the first target on mount as active even if not (yet) intersecting. |
159-
| jumpToLast | `boolean` | true | Whether to set the last target as active once reached the bottom even if previous targets are entirely visible. |
160-
| boundaryOffset | `BoundaryOffset` | { toTop: 0, toBottom: 0 } | Boundary offset in px for each scroll direction. Tweak them to "anticipate" or "delay" target detection. |
161-
| rootId | `string` \| `null` | null | Id of the scrolling element. Set it only if your content **is not scrolled** by the window. |
162-
| replaceHash | `boolean` | false | Whether to replace URL hash on scroll. First target is ignored if `jumpToFirst` is true. |
163-
| overlayHeight | `number` | 0 | Height in pixels of any **CSS fixed** content that overlaps the top of your scrolling area (e.g. fixed header). Must be paired with a CSS [scroll-margin-top]() rule. |
164-
| minWidth | `number` | 0 | Whether to toggle listeners and functionalities within a specific width. Useful if hiding the sidebar using `display: none`. |
159+
| Property | Type | Default | Description |
160+
| -------------- | ------------------ | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
161+
| jumpToFirst | `boolean` | true | Whether to set the first target on mount as active even if not (yet) intersecting. |
162+
| jumpToLast | `boolean` | true | Whether to set the last target as active once reached the bottom even if previous targets are entirely visible. |
163+
| boundaryOffset | `BoundaryOffset` | { toTop: 0, toBottom: 0 } | Boundary offset in px for each scroll direction. Tweak them to "anticipate" or "delay" target detection. |
164+
| rootId | `string` \| `null` | null | Id of the scrolling element. Set it only if your content **is not scrolled** by the window. |
165+
| replaceHash | `boolean` | false | Whether to replace URL hash on scroll. First target is ignored if `jumpToFirst` is true. |
166+
| overlayHeight | `number` | 0 | Height in pixels of any **CSS fixed** content that overlaps the top of your scrolling area (e.g. fixed header). Must be paired with a CSS [scroll-margin-top](#setting-scroll-margin-top-for-fixed-headers) rule. |
167+
| minWidth | `number` | 0 | Whether to toggle listeners and functionalities within a specific width. Useful if hiding the sidebar using `display: none`. |
165168

166169
### Return object
167170

@@ -326,7 +329,7 @@ html {
326329

327330
<br />
328331

329-
## Adjusting overlayHeight targets' margin
332+
## Setting scroll-margin-top for fixed headers
330333

331334
You might noticed that if you have a fixed header and defined an `overlayHeight`, once you click to scroll to a target it may be underneath the header. You must set `scroll-margin-top` to your targets:
332335

cypress.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineConfig } from 'cypress';
22

33
export default defineConfig({
44
component: {
5+
video: false,
56
viewportWidth: 1366,
67
experimentalWebKitSupport: true,
78
viewportHeight: 768,

demo/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<link rel="icon" href="/favicon.ico" />
7-
<title>vue-use-active-scroll</title>
7+
<title>Vue Use Active Scroll</title>
8+
<meta
9+
name="description"
10+
content=" Reactive and accurate TOC/sidebar links without compromises."
11+
/>
812
</head>
913
<body>
1014
<div id="app"></div>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-use-active-scroll",
3-
"version": "0.9.0",
3+
"version": "0.9.2",
44
"private": false,
55
"description": "Reactive and accurate TOC/sidebar links without compromises for Vue 3.",
66
"keywords": [

pnpm-lock.yaml

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)