enable the back button
This commit is contained in:
parent
84cc12ebaa
commit
92e2f47f18
1 changed files with 10 additions and 1 deletions
|
@ -66,7 +66,16 @@ function ComicBook(id, srcs, opts) {
|
||||||
|
|
||||||
// the current page, can pass a default as a url hash
|
// the current page, can pass a default as a url hash
|
||||||
var pointer = (parseInt(location.hash.substring(1),10) - 1) || 0;
|
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.
|
* Figure out the cursor position relative to the canvas.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue