swipe navigation
This commit is contained in:
parent
643781375d
commit
f429c4aafe
3 changed files with 16 additions and 2 deletions
|
@ -13,6 +13,7 @@
|
||||||
<script src="../lib/vendor/pixastic/pixastic.effects.js"></script>
|
<script src="../lib/vendor/pixastic/pixastic.effects.js"></script>
|
||||||
<script src="../lib/vendor/pixastic/pixastic.worker.js"></script>
|
<script src="../lib/vendor/pixastic/pixastic.worker.js"></script>
|
||||||
<script src="../lib/vendor/handlebars.runtime-1.0.rc.1.min.js"></script>
|
<script src="../lib/vendor/handlebars.runtime-1.0.rc.1.min.js"></script>
|
||||||
|
<script src="../lib/vendor/quo.js"></script>
|
||||||
<script src="../lib/templates.js"></script>
|
<script src="../lib/templates.js"></script>
|
||||||
<script src="../lib/ComicBook.js"></script>
|
<script src="../lib/ComicBook.js"></script>
|
||||||
<link rel="stylesheet" href="../css/reset.css">
|
<link rel="stylesheet" href="../css/reset.css">
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
- allow toolbar to be sticky
|
- allow toolbar to be sticky
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var ComicBook = (function ($) {
|
var ComicBook = (function ($, $$) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -93,9 +93,12 @@ var ComicBook = (function ($) {
|
||||||
|
|
||||||
// mobile enhancements
|
// mobile enhancements
|
||||||
if (navigator.userAgent.match(/mobile/i)) {
|
if (navigator.userAgent.match(/mobile/i)) {
|
||||||
|
|
||||||
this.isMobile = true;
|
this.isMobile = true;
|
||||||
document.body.classList.add('mobile');
|
document.body.classList.add('mobile');
|
||||||
|
|
||||||
defaults.displayMode = 'single';
|
defaults.displayMode = 'single';
|
||||||
|
|
||||||
window.addEventListener("load",function() {
|
window.addEventListener("load",function() {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
window.scrollTo(0, 1);
|
window.scrollTo(0, 1);
|
||||||
|
@ -194,6 +197,7 @@ var ComicBook = (function ($) {
|
||||||
// add page controls
|
// add page controls
|
||||||
window.addEventListener('keydown', self.navigation, false);
|
window.addEventListener('keydown', self.navigation, false);
|
||||||
window.addEventListener('hashchange', checkHash, false);
|
window.addEventListener('hashchange', checkHash, false);
|
||||||
|
$$('body').swipeLeft(self.navigation).swipeRight(self.navigation);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('touchstart', function (e) {
|
window.addEventListener('touchstart', function (e) {
|
||||||
|
@ -797,12 +801,16 @@ var ComicBook = (function ($) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'swipeLeft': side = 'right'; break;
|
||||||
|
case 'swipeRight': side = 'left'; break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw ComicBookException.INVALID_NAVIGATION_EVENT + ' ' + e.type;
|
throw ComicBookException.INVALID_NAVIGATION_EVENT + ' ' + e.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (side) {
|
if (side) {
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
// western style (left to right)
|
// western style (left to right)
|
||||||
|
@ -810,6 +818,7 @@ var ComicBook = (function ($) {
|
||||||
if (side === 'left') { self.drawPrevPage(); }
|
if (side === 'left') { self.drawPrevPage(); }
|
||||||
if (side === 'right') { self.drawNextPage(); }
|
if (side === 'right') { self.drawNextPage(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// manga style (right to left)
|
// manga style (right to left)
|
||||||
else {
|
else {
|
||||||
if (side === 'left') { self.drawNextPage(); }
|
if (side === 'left') { self.drawNextPage(); }
|
||||||
|
@ -841,4 +850,4 @@ var ComicBook = (function ($) {
|
||||||
|
|
||||||
return ComicBook;
|
return ComicBook;
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery, Quo);
|
||||||
|
|
4
lib/vendor/quo.js
vendored
Executable file
4
lib/vendor/quo.js
vendored
Executable file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue