Yo! The default smooth scroll is kinda meh, right? For more control, try GSAP’s ScrollTo plugin. I know you said no libraries, but GSAP is lightweight and gives you insane easing options.
If you’re dead set on vanilla, here’s a quick hack:
```js
const scrollToEl = (element) => {
const targetPos = element.getBoundingClientRect().top + window.scrollY;
window.scrollTo({
top: targetPos,
behavior: 'smooth'
});
};
```
Not perfect, but better than nothing.
If you’re dead set on vanilla, here’s a quick hack:
```js
const scrollToEl = (element) => {
const targetPos = element.getBoundingClientRect().top + window.scrollY;
window.scrollTo({
top: targetPos,
behavior: 'smooth'
});
};
```
Not perfect, but better than nothing.
