Hi, i have an ebook(relatively large size say 800 pages),in HTML format. I am opening that book as webpage using webkit-gtk+. If i load the whole book at a time,it takes too much memory(RAM ).So i dont want to load the whole book at a time, but load the part of the book which is currently on display. and when the user scrolls down, next part should be displayed.How can i implement that ?
The most simple solution is to cut the book into pages and then use links at the top and bottom to move between them.
If you really want to try the "endless scrolling book" metaphor, then you must also split the book into pages on the server. Now, you can use JavaScript to watch for the scrolling events and load the next page with AJAX as soon as the visitor comes close to the edge.
The problem here is when to get rid of the parts the visitor has read. Also, the scroll bar will jump around a lot. So the experience for the user won't be that great either way. To get an idea how it feels, load a huge RSS feed into Google Reader. It won't drop articles that you've seen, so the browser slowly eats more and more memory. On the positive side, the scroll bar doesn't jump that madly.