more work on scrolling...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-02-12 18:50:40 +04:00
parent eb19688eb6
commit ac80871bb8
2 changed files with 12 additions and 3 deletions

View File

@ -86,11 +86,14 @@ $(document).ready(function(){
}, },
function(k){console.log(k)})) function(k){console.log(k)}))
/* $('.viewer')
.on('mouseup touchend', function(evt){
setCurrentPage()
})
if(!NAVIGATE_RELATIVE_TO_VISIBLE){ if(!NAVIGATE_RELATIVE_TO_VISIBLE){
$('.viewer').css({overflow: 'hidden'}) $('.viewer').css({overflow: 'hidden'})
} }
*/
// expand the templates... // expand the templates...
runMagazineTemplates() runMagazineTemplates()

View File

@ -4,7 +4,8 @@
* *
**********************************************************************/ **********************************************************************/
var NAVIGATE_RELATIVE_TO_VISIBLE = false //var NAVIGATE_RELATIVE_TO_VISIBLE = false
var NAVIGATE_RELATIVE_TO_VISIBLE = true
var USE_PAGE_ALIGN = true var USE_PAGE_ALIGN = true
@ -78,11 +79,16 @@ var togglePageView = createCSSClassToggler(
/********************************************************* helpers ***/ /********************************************************* helpers ***/
function getPageNumber(page){ function getPageNumber(page){
// a page is given...
if(page != null){ if(page != null){
return $('.page').index($(page)) return $('.page').index($(page))
} }
// get the next page...
if(!NAVIGATE_RELATIVE_TO_VISIBLE){ if(!NAVIGATE_RELATIVE_TO_VISIBLE){
return $('.page').index($('.current.page')) return $('.page').index($('.current.page'))
// get the closest page to view...
} else { } else {
// XXX this gets crazy when magazine is scaled... // XXX this gets crazy when magazine is scaled...
var s = $('.viewer').scrollLeft() var s = $('.viewer').scrollLeft()