I'm using SvelteKit and trying to split a long string into pages based on viewport. Basically, I need a similar functionality of an e-reader or Kindle, where it shows only the text that fits on the screen at a time.
I tried calculating the number of lines that would fit on the viewport using window.innerHeight
and -webkit-line-clamp
to hide the rest of the text, but don't know how to create different pages and add navigation.
Is there a js library or npm package that can help me with this?