I'm looking to implement a check when a user has scrolled to the bottom of the pdfviewer using dotnet mvc/jquery.
Iv found the following articles
https://docs.telerik.com/devtools/wpf/knowledge-base/kb-pdfviewer-scroll-to-last-page
https://www.telerik.com/forums/how-to-access-scroller-of-pdfviewer
and iv managed to hook into the scroll functionality through a private scroller field like so
still figuring out the calculation...
<script>
function onPdfViewerComplete(e){
debugger;
try {
const scroller = e.sender._scroller;
const scrollPosition = scroller.scrollTop;
const maxScrollPosition = scroller.scrollHeight - scroller.clientHeight;
scroller.bind('scroll', ()=> {
if (scrollPosition >= maxScrollPosition) {
alert("Scrolled to the bottom of the PDF");
}
});
} catch(e) {
console.error("error", e);
}
}
</script>
Is there any better way to handle this? the documentation seems sparse around this.