Created
June 22, 2011 16:17
-
-
Save neolao/1040463 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Here we go, show the magazine */ | |
$('#viewer').booklet({ | |
width: bookWidth * 2, | |
height: bookHeight, | |
speed: 750, | |
pagePadding: 0, | |
pageNumbers: false, | |
closed: true, | |
autoCenter: true, | |
hash: false, | |
arrows: false, | |
manual: false, | |
hovers: false, | |
after: function(opts){ | |
var fCountActual = parseInt(opts.curr); | |
if (fCountActual == 0){ | |
fCountActual = opts.curr + 1; | |
window.location.hash = "/page/1"; | |
}else if(fCountActual == MadMagzPagesCount){ | |
fCountActual = opts.curr; | |
window.location.hash = "/page/" + opts.curr; | |
}else{ | |
fCountActual = opts.curr+'-'+(opts.curr+1); | |
window.location.hash = "/page/" + opts.curr; | |
} | |
$('#fCountActual').empty().append(fCountActual); | |
} | |
}); | |
/* Prepare functions for navigation */ | |
lastHash = null; | |
function getHash(){ | |
var windowHash = window.location.hash; | |
windowHash = windowHash.split('/'); | |
return windowHash[2]; | |
} | |
function updateBooklet() | |
{ | |
var newHash = getHash(); | |
if (newHash != lastHash) { | |
$('#viewer').booklet(parseInt(newHash)); | |
} | |
} | |
$(window).bind("hashchange", updateBooklet); | |
updateBooklet(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment