Is there any way to specify scroll-behavior runtime: Smooth?

Asked

Viewed 62 times

5

The estate scroll-behavior: smooth allows you to change the behavior of the scroll to be smoother.

Example:

#scroll{
   overflow: auto;
   height: 600px;
   width: 100%;
   scroll-behavior: smooth
}

#a, #b {
  height: 600px;
}

#a{
   background-color: red;
}

#b {
  background-color: green;
}
<div id="scroll">
  <a href='#b'>Faça o scroll</a>
  <div id='a'></div>
  <div id='b'></div>
</div>

But as far as I can tell, it looks like ownership smooth already has its own standard time to run the smooth scroll.

I would like to know if it is possible to increase or decrease the smooth scrolling time when using scroll-behavior only by CSS - i.e., without the use of Javascript.

  • 1

    Apparently that property is still draft, then perhaps in the future there will be some suggestion for implementation, but this is just speculation. Anyway controlling this would be a little annoying for the end user, unless there was a range of time limit, maybe of 0.01s until 1.0s (only example).

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.