-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to listen to scroll events #249
Comments
Any solution yet? |
1 similar comment
Any solution yet? |
@Areeb-dev I fixed this but forgot how i did it so I just gave my code to GPT to explain as i dont have the time to fully recollect my though process months back. This is what GPT had to say: The
PdfHighlighter scrollRef Prop: The scrollRef prop of the PdfHighlighter component is used to get a reference to the scroll function, which is stored in viewerScrollTo.current. This allows programmatic scrolling to specific highlights when required.
UseEffect Hook with pdfElem: This useEffect hook attaches an event listener to the PDF element (pdfElem[0]). This event listener updates the current page number whenever the user scrolls within the PDF. The getPdfInViewPageNumber function is used to determine which page is currently in view.
In summary, the handling of scroll events on the PDF is managed through the onScrollChange and scrollRef props of the PdfHighlighter component, as well as the useEffect hook that attaches a scroll event listener to the PDF element. |
Hey @codiejay , |
How to listen to scroll events
The text was updated successfully, but these errors were encountered: