blasten / turn.js

The page flip effect for HTML5
www.turnjs.com
Other
7.23k stars 2.48k forks source link

Auto Turning Flipbook #179

Closed tarairvine closed 12 years ago

tarairvine commented 12 years ago

I have tried to add some timer functions to wait a number of milliseconds and then progress the book. Nothing to advanced for starters just

if(isIpadOrSmallScreen()){
        flipbookHeight = 522;
        flipbookWidth = 704;
}else{
        flipbookHeight = 779;
        flipbookWidth = 1076;
}
    $("#flipbook").turn({
        width: flipbookWidth,
        height: flipbookHeight,
        duration:1000,

    });

setTimeout($("#flipbook").turn("next"),3000);
setTimeout($("#flipbook").turn("next").turn("next"),6000);

When I view the page it just animates to the last page, no waiting or animation for the first page.

I have read this - https://github.com/blasten/turn.js/issues/171

But the solution isn't working for my project. There only ever is 4 pages so I need the code to wait 3 seconds and then flip to the middle pages then wait say 5 seconds and move onto the last page.

Is this possible?

Thanks very much.

blasten commented 12 years ago

I think the problem is that setTimeout cannot be called in that way, because next doesn't return a function. Please replace it by:

setTimeout(function() { $("#flipbook").turn("next"); } , 3000);
setTimeout(function() { $("#flipbook").turn("next").turn("next"); }, 6000);