Methods for breaking up content client-side into multiple "pages"

Posted by Tom Genoni on Stack Overflow See other posts from Stack Overflow or by Tom Genoni
Published on 2010-05-28T17:28:07Z Indexed on 2010/05/28 17:32 UTC
Read the original article Hit count: 136

Filed under:

I have a long HTML text-only article formatted with paragraph tags. What I'd like to do is break this content into N number of divs so that I can create individual pages. So, for instance, on an iPad/iPhone, instead of reading one long page the user could swipe right/left to navigate to pages.

My initial javascript attempts have been somewhat convoluted: creating an array of the text, measuring line-heights, device window heights, adding closing/opening paragraph tags and the end/beginning of pages.

Thoughts on a good way to approach this? I will not have access to server-side processing, this has to be a client-side solution.

© Stack Overflow or respective owner

Related posts about JavaScript