最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

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

matteradmin4PV0评论

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.

Post a comment

comment list (0)

  1. No comments so far