enable the back button

This commit is contained in:
Bala Clark 2010-12-25 09:44:57 +01:00
parent 84cc12ebaa
commit 92e2f47f18

View file

@ -67,6 +67,15 @@ function ComicBook(id, srcs, opts) {
// the current page, can pass a default as a url hash
var pointer = (parseInt(location.hash.substring(1),10) - 1) || 0;
// enables the back button by tracking any url hash changes and loading the correct page.
setInterval(function() {
var hash = parseInt(location.hash.substring(1),10) - 1;
if (hash !== pointer) {
pointer = hash;
ComicBook.prototype.draw();
}
}, 300);
/**
* Figure out the cursor position relative to the canvas.
*