blasten/turn.js

How to load each page dynamically.

Opened this issue · 2 comments

I each new page that will be called to be fetched dynamically. Sample code below.
The error is get is, on content of the PHP file appears about 3 times before it changes.

Page 1
PREV NEXT

var flipbook = $("#flipbook");

flipbook.turn({
elevation: 50,
width: 800,
height: 500,
autoCenter: false,
display: 'single',
pages: 10,
duration: 1000,
when: {
turned: function(e, page, view) {
addPage(2, $(this));
},
missing: function (e, pages) {
for (var i = 0; i < pages.length; i++) {
addPage(pages[i], $(this));
}
}
}
});

function loadPage(page) {
$.ajax({
url: '/turnjs4/samples/processor.php'
}).done(function(pageHtml) {
$('#flipbook .p' + page).html(pageHtml);
});
}

function addPage(page, book) {
var id, pages = book.turn('pages');
var element = $('

',
{'class': 'own-size',
css: {width: 460, height: 582}
}).
html('
Loading...
');
if (book.turn('addPage', element, page)) {
loadPage(page);
}
}

No please i could not get any help