最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

next.js - OneTrust Cookie Settings Link Scrolling Page To Top - Stack Overflow

programmeradmin2浏览0评论

In a NextJS app(v13.5), clicking the OneTrust Cookie settings link in the footer triggers the page to scroll to the top when the modal popup appears. After closing the modal, the page scrolls back down to the footer. Is there a way to prevent this behavior?

<a className="ot-sdk-show-settings">Cookie Settings</a>

I replaced the anchor tag with button, div, and span elements, and tried using e.preventDefault() on the click and captured the scrollY position to prevent scrolling, but no luck so far.

Any assistance would be greatly appreciated.

发布评论

评论列表(0)

  1. 暂无评论