0

I'm creating a portfolio with nuxt.js and i'm using a node module which is vue-smooth-scrollbar to have a smooth scroll in my page content.

The problem is I don't know how to scroll to a specific element in my scrolling content because it is implementing a new way of scrolling with a translate3D.

Does anyone know if there is a function to this package so I can scroll to a specific container with an anchor?

kissu
  • 40,416
  • 14
  • 65
  • 133
Pliboux
  • 109
  • 1
  • 1
  • 8
  • 1
    Hi, I have some answers regarding the scroll: https://stackoverflow.com/search?q=user%3A8816585+scroll Tell me if any of those are enough or if you really want me to check your specific package. – kissu Apr 14 '22 at 23:42
  • 1
    Otherwise, could you please provide more details regarding your template? – kissu Apr 15 '22 at 10:30
  • @kissu Thanks for replying and sorry for the late answer. I've searched for answers in your link but the problem is about the vue component which is vue-smooth-scrollbar. I know how to scroll to anchor but the component makes it impossible because i think it is not enough developped to do this kind of thing. I don't want you to lose you time on this library but if you have an alternative solution to have a smooth scroll and to be able to scroll to a specific anchor on my page, your solution would be appreciated. – Pliboux Apr 15 '22 at 17:31

1 Answers1

1

The package you're talking about is 6 months old with no documentation and it's more aimed towards the actual smoothness of the scrollbars.

My answer here is about how to scroll to a specific element in your page. This is also just 2kB so good enough.

This being usable anywhere on the page

VueScrollTo.scrollTo(this.$refs.regForm, 1000, { easing: 'linear' })

You can of course also scroll to a hash.


Otherwise, smooth scroll is also available in JS vanilla.

kissu
  • 40,416
  • 14
  • 65
  • 133