You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-4Lines changed: 14 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,4 @@
1
1
# Highlight your menu items as you scroll
2
-
3
2
This vue 2 component makes it simple to highlight a menu item with an 'active' class as you scroll.
4
3
5
4
- Highlights menu items as you scroll
@@ -20,7 +19,7 @@ Vue.use(Scrollactive);
20
19
```
21
20
22
21
## Usage
23
-
You should wrap your menu in a `<scrollactive>` (which will be your nav) and add a .scrollactive-item class in your `<a>` tags as I show in the example below:
22
+
You should wrap your menu in a `<scrollactive>`tag (which will be your nav) and add a `.scrollactive-item` class in your `<a>` tags as I show in the example below:
24
23
25
24
```html
26
25
<scrollactiveclass="my-nav">
@@ -31,10 +30,21 @@ You should wrap your menu in a `<scrollactive>` (which will be your nav) and add
31
30
</scrollactive>
32
31
```
33
32
34
-
You can follow whatever structure you wish, just make sure to set the .scrollactive-item class in the items you want to highlight and set its `href` with a valid ID that you would like to scroll over.
33
+
You can follow whatever structure you wish, just make sure to set the `.scrollactive-item` class in the items you want to highlight and set its `href` with a valid ID that you would like to track while scrolling.
35
34
36
-
## Props configuration
35
+
## Events
36
+
Scrollactive will fire an `itemchanged` event when an active menu item is changed to another, you can catch that event doing as the example below:
0 commit comments