Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

How to paginate text based on viewport?

$
0
0

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?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>