Passing Mutilple parameters when flipping through Pages in Turn.js

95 Views Asked by At

I am trying to pass multiple parameters on flip using turn.js. The current option only made provision for the pageNumber ie.

Instead of

function addPage (page, book) {
    //Check if the page is not in the book
    if ( ! book. turn( 'hasPage' , page)) {
        // Create an element for this page
        var element = $ ( '<div />' ). html ( 'Loading…' );
        // Add the page
        book.turn( 'addPage' , element, page);
        // Get the data for this page
        $.ajax ({url : "app?method=get-page-content&page=" + page)
            .done( function (data) { element. html (data); });
    }
}

I want

function addPage (page, book) {
    // Check if the page is not in the book
    if ( ! book. turn( 'hasPage' , page)) {
        // Create an element for this page
        var element = $ ( '<div />' ). html ( 'Loading…' );
        // Add the page
        book.turn( 'addPage' , element, page, chapter);
        // Get the data for this page
        $.ajax ({url : "app?method=get-page-content&page="+ 
page+ "&currentChapter" + chapter)
            .done( function (data) { element. html (data); });
    }
}

So that I can determine the page in a chapter to serve.

Sample code will be greatly appreciated.

0

There are 0 best solutions below