caiofsouza / vue-backtotop

A Back-to-top component for Vue.js, which scroll page to the top when clicked
https://caiofsouza.github.io/vue-backtotop/example/
MIT License
182 stars 42 forks source link

Doesn't work on other elements but body #32

Open naya-u opened 4 years ago

naya-u commented 4 years ago

Hi! Can you please add support of optional scrollable element? I think this can be achieved by simple check if, for example, prop "parentId" is not empty and then if not - use document.getElementById(this.parentId).scrollTop and document.getElementById(this.parentId).offsetHeight instead document.body.scrollTop and document.body.offsetHeight respectively. I'm not sure if there's gonna be some problems with this solution, but it worked for me. Huge thanks for plugin, btw!