Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Safari equivalent for scroll-behavior: smooth;?

Tags:

css

safari

I'm working on a single page portfolio which is navigated using a top-mounted navigation bar using href's. I use scroll-behavior: smooth; in my head's CSS and this makes the navigating smooth and pleasant to look at when looking at it in chrome. When loading the site using Safari this behavior is lost and the navigation is instant. Is there a Safari equivalent to this CSS functionality?

like image 752
Florian Schut Avatar asked May 06 '19 19:05

Florian Schut


People also ask

How do I make my anchor link scroll smoother?

You can use window. scroll() with behavior: smooth and top set to the anchor tag's offset top which ensures that the anchor tag will be at the top of the viewport.

Should I enable smooth scrolling?

Enabling a smooth scroll allows you to scroll like that with your regular wheel scroll. Smooth scrolling is also useful with keyboard shortcuts. When this feature is enabled, pressing the Page Down button won't just jump directly down one page.


1 Answers

Safari does not support scroll-behavior: smooth, you'll need some custom javascript to achieve the same effect. See this: Javascript - window.scroll({ behavior: 'smooth' }) not working in Safari

like image 89
Aditya Thakur Avatar answered Oct 04 '22 17:10

Aditya Thakur