turn.js: altering URL when using mouse to change page

986 views Asked by At

I'm using turn.js on a website I'm working in and have had some issues relating to altering the URL when using the mouse flip through the pages of the book like site. So far I've tried:

flipbook.bind('start', function (event, page, corner) {
    if (corner == 'tr') {
        changeUrl('plus'); //just a function that increments page number
    } else if (corner == 'tl') {
        changeUrl('minus'); //just a function that decrements page number
    }
});

This work in that when the page turns, it updates my URL using the changeUrl() function. However it changes the page already when I hover over the edges of the page. I need the page to turn only after I've clicked the page corners and not already when hovering over them.

I've also tried

    flipbook.bind('turning', function (event, page, corner) {
        if (page%2 == 0) {
           changeUrl('plus');
        } else if (page%2 != 0) {
           changeUrl('minus');
        }
    });

Which works technically, but it messes up my links and sends me to the final page of the turn.js app no matter where I've set the link to go to.

If anyone knows any other way manipulate what happens when I use the mouse click on turn.js and not on hover I would really appreciate some help! Thank you!

1

There are 1 answers

0
AudioBubble On BEST ANSWER

Try the following. It should work

flipbook.bind('turning',function (event, page, corner) {
    Hash.go('page/'+page).update();
});