Hi, I am looking for a way to reset the scroll position or scroll to top. I found a way using plain JS.
const el = new SimpleBar(document.getElementById('layout'));
el.contentEl.scrollTop = 0;
But how can I do that in vue??
| Software | Version(s) |
| ---------------- | ---------- |
| simplebar-vue | latest
| Browser | Chrome 73.0.3683.1
| npm/Yarn | npm 6.4.1
| Operating System | Windows 10
Never mind. I figured it out. Here is the solution if someone is looking for.
First you have set a reference to the scrollbar.
<simplebar ref="Scroller" >
....content
</simplebar>
Then you can access the SimpleBar instance like this
const ref = this.$refs.Scroller;
const el = ref.$el.SimpleBar;
el.contentEl.scrollTop = 0
You are welcome :)
Most helpful comment
Never mind. I figured it out. Here is the solution if someone is looking for.
First you have set a reference to the scrollbar.
Then you can access the SimpleBar instance like this
You are welcome :)