javascripthtmlcssturnjs

Hash navigation in Turn.js


I´ve been exploring turn.js script and after a long study of script hash.js I did not find the way how to make navigation across the flipbook. Like here

I don´t know how exactely am I supposted to create "url" for each page. Can somone advise me what should I google or if someone face the problem and will help me I would appreciate it so much.


Solution

  • I´ve added code:

    Hash.on('^page\/([0-9]*)$', {
        yep: function(path, parts) {
    
            var page = parts[1];
    
            if (page!==undefined) {
                if ($('#flipbook').turn('is'))
                    $('#flipbook').turn('page', page);
            }
    
        },
        nop: function(path) {
    
            if ($('#flipbook').turn('is'))
                $('#flipbook').turn('page', 1);
        }
    });