【问题标题】:React Bootstrap Scrollspy active link not working in Android mobile browserReact Bootstrap Scrollspy 活动链接在 Android 移动浏览器中不起作用
【发布时间】:2023-02-01 17:40:52
【问题描述】:
我有使用引导程序 5.2.2在反应并在菜单中实现 Scrollspy 功能。
Scrollspy 在 Web(笔记本电脑)浏览器中运行良好。此外,它在 iPhone 手机上运行良好。但是,Scrollspy 更新了在 Android Mobile 中不起作用的活动链接。
现场直播地址:https://rutvik.online
有人可以检查我的页面,看看他们是否可以确定问题所在吗?
【问题讨论】:
标签:
android
html
reactjs
react-native
bootstrap-5
【解决方案1】:
这似乎是一个浏览器支持问题,而不是操作系统兼容性问题,因为它在 Safari、Firefox 和 Edge 上运行良好,但在 Brave 或 DuckDuckGo 上运行不佳。
编辑:
在我降级到 Bootstrap 5.1.3(来自 npm)之前,我实际上遇到了同样的问题,以这种方式导入 scrollspy:
import "bootstrap/js/src/scrollspy.js";
document.body.setAttribute("data-bs-spy", "scroll");
document.body.setAttribute("data-bs-target", "#scrollspy-nav");
document.body.setAttribute("data-bs-offset", "150");
Scrollspy 已被重写为使用 Intersection Observer API,我相信这是 Bootstrap 5.2.x 中出现问题的原因,但我现在没有时间研究它。
https://getbootstrap.com/docs/5.3/migration/#additional-changes