是否有与Safari等效的滚动行为:平滑;? [英] Is there a Safari equivalent for scroll-behavior: smooth;?

查看:445
本文介绍了是否有与Safari等效的滚动行为:平滑;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个单页组合,可使用href的顶部安装的导航栏对其进行导航.我在头部的CSS中使用了scroll-behavior: smooth;,这使得导航在使用chrome浏览时看起来平滑而愉悦.使用Safari加载网站时,此行为会丢失,并且导航是即时的.是否有一个与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?

推荐答案

Safari不支持scroll-behavior: smooth,您需要一些自定义javascript才能实现相同的效果.请参阅: Javascript-window.scroll({行为:'smooth '})在Safari中不起作用

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

这篇关于是否有与Safari等效的滚动行为:平滑;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆