From 26c293308c2e478edd59a4052bcd121bb80129b0 Mon Sep 17 00:00:00 2001 From: wuqi Date: Tue, 19 Jul 2016 14:48:11 +0800 Subject: [PATCH] mouse wheel --- cps/templates/read.html | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/cps/templates/read.html b/cps/templates/read.html index badd2f2a..d14519f0 100644 --- a/cps/templates/read.html +++ b/cps/templates/read.html @@ -19,9 +19,8 @@ document.onreadystatechange = function () { if (document.readyState == "complete") { - EPUBJS.filePath = "{{ url_for('static', filename='js/libs/') }}";//"js/libs/"; - EPUBJS.cssPath = "{{ url_for('static', filename='css/') }}";//window.location.href.replace(window.location.hash, '').replace('read.html', '') + "css/"; - // fileStorage.filePath = EPUBJS.filePath; + EPUBJS.filePath = "{{ url_for('static', filename='js/libs/') }}"; + EPUBJS.cssPath = "{{ url_for('static', filename='css/') }}"; window.reader = ePubReader("{{ url_for('static', filename=bookid) }}/"); //keybind @@ -33,6 +32,21 @@ window.reader.book.nextPage(); } }); + //bind mouse + $(window).bind('DOMMouseScroll mousewheel', function(event) { + var delta = 0; + if (event.originalEvent.wheelDelta) { + delta = event.originalEvent.wheelDelta; + }else if (event.originalEvent.detail) { + delta = event.originalEvent.detail*-1; + } + if (delta >= 0) { + window.reader.book.prevPage(); + } + else { + window.reader.book.nextPage(); + } + }); } };