admin管理员组

文章数量:1025560

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.

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.

本文标签: nextjsOneTrust Cookie Settings Link Scrolling Page To TopStack Overflow