From f55de66d9c68a149c4929da779ad485e584c136f Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 26 Jan 2013 22:48:59 +0400 Subject: [PATCH] some fixes and added a basic 'online' configuration demo (last article)... Signed-off-by: Alex A. Naanou --- index.html | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ jli.js | 2 +- magazine.js | 17 +++++++++++++---- 3 files changed, 68 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index d7d3a22..2e02862 100755 --- a/index.html +++ b/index.html @@ -14,6 +14,8 @@ + + + @@ -352,3 +405,4 @@ $(document).ready(function(){ + diff --git a/jli.js b/jli.js index 808541c..b177d9e 100755 --- a/jli.js +++ b/jli.js @@ -7,7 +7,7 @@ * looks... **********************************************************************/ -var DEBUG = true +//var DEBUG = DEBUG != null ? DEBUG : true /*********************************************************************/ diff --git a/magazine.js b/magazine.js index 56362a8..e4b4e7f 100755 --- a/magazine.js +++ b/magazine.js @@ -1,17 +1,20 @@ /********************************************************************** **********************************************************************/ -var DEBUG = true +//var DEBUG = DEBUG != null ? DEBUG : true // number of pages to display in ribbon... var PAGES_IN_RIBBON = 6 // if true, expand a page to fit the whole view in single page mode... -var FIT_PAGE_TO_VIEW = false +var FIT_PAGE_TO_VIEW = true // if true will make page resizes after window resize animated... var ANIMATE_WINDOW_RESIZE = true +// if true will disable page dragging in single page mode... +var DRAG_FULL_PAGE = false + /*********************************************************************/ @@ -31,7 +34,7 @@ togglePageView = createCSSClassToggler( // post-change callback... function(action){ if(action == 'on'){ - fitNPages(1) + fitNPages(1, !FIT_PAGE_TO_VIEW) } else { fitNPages(PAGES_IN_RIBBON) } @@ -63,6 +66,8 @@ function getPageNumber(page){ /************************************************** event handlers ***/ +// swipe state handler +// this handles single and double finger swipes and dragging function swipeHandler(evt, phase, direction, distance, duration, fingers){ var pages = $('.page') var cur = $('.current.page') @@ -70,7 +75,11 @@ function swipeHandler(evt, phase, direction, distance, duration, fingers){ var scale = getPageScale() var mag = $('.magazine') - if(phase=='move' && (direction=='left' || direction=='right')){ + if(phase=='move' + // see if wee need to drag the page and allways drag the ribbon... + && (DRAG_FULL_PAGE || togglePageView('?') == 'off') + && (direction=='left' || direction=='right')){ + // using the "unanimated" trick we will make the drag real-time... mag.addClass('unanimated') if(direction == 'left'){ $('.magazine').css({left: -n*cur.width()-distance/scale})