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
+17-4Lines changed: 17 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ Vue.use(Scrollactive);
24
24
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:
@@ -38,17 +38,29 @@ You can follow whatever structure you wish, just make sure to set the `.scrollac
38
38
Scrollactive will emmit an `itemchanged(event, currentItem, lastActiveItem)` event when an active menu item is changed to another, you can catch that event doing as the example below:
All options should be passed as a prop in the `<scrollactive>` component as you can see in the example below:
49
+
## Dynamic menu items
50
+
In order for the component to update when you add a new menu item, you must call the `setScrollactiveItems()` function. You can do that as I do in the example below:
51
+
```javascript
52
+
methods: {
53
+
dynamicItemsFunction() {
54
+
// Add your items
55
+
this.$refs.scrollactive.setScrollactiveItems();
56
+
}
57
+
}
58
+
```
59
+
60
+
Make sure to set the `ref=scrollactive` property when you call the component in order to access the function as I do, or feel free to do it in any other way you would like, you just need to call the `setScrollactiveItems()` function.
51
61
62
+
## Configuration
63
+
All options should be passed as a prop in the `<scrollactive>` component as you can see in the example below:
52
64
```html
53
65
<scrollactive
54
66
active-class="active"
@@ -58,6 +70,7 @@ All options should be passed as a prop in the `<scrollactive>` component as you
0 commit comments