Turn.js can work with very long flipbooks. That is, there’s no limit regarding the amount of pages that it can contain. This is because turn.js only keeps in DOM the last 6 pages no matter how long the book is. There will still be references to the content that was previously loaded, but it’s possible to reduce the cache in order to release memory.
I want to keep the first 7 pages in the DOM. How can do this?
pagesInDOM
limitation is 6 as defined in turn.js.
html
<div id=”flipbook”>
<div class=”hard”>Page 1</div>
<div class=”hard”>Page 2</div>
<div class=”hard”>Page 3</div>
<div class=”hard”>Page 4</div>
<div class=”hard”>Page 5</div>
<div class=”hard”>Page 6</div>
<div class=”hard”>Page 7</div>
<div class=”hard”>Page 8</div>
<div class=”hard”>Page 9</div>
<div class=”hard”>Page 10</div>
</div>
js
var oTurn = $('#flipbook').turn({
width: 1700,
height: 850,
elevation: 50,
gradients: false,
autoCenter: true,
acceleration: true,
start: function (event, pageObject, corner) {
if (pageObject.next === 1)
event.preventDefault();
},
turning: function (event, page, view) {
if (page === 1)
event.preventDefault();
}
});