mirror of
https://github.com/flynx/PortableMag.git
synced 2025-12-22 19:41:47 +00:00
made the layout.html's getPageNumber compatible with the main implementation in magazine.js...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
0abaece2ca
commit
76499b6c8f
28
layout.html
28
layout.html
@ -45,18 +45,22 @@
|
||||
|
||||
<script>
|
||||
|
||||
function getPageNumber(){
|
||||
var s = $('.viewer').scrollLeft()
|
||||
var W = $('.viewer').width()
|
||||
var cur = -1
|
||||
var res = $('.page').map(function(i, e){
|
||||
e = $(e)
|
||||
var l = e.position().left
|
||||
var w = e.width()
|
||||
return Math.abs((l+(w/2)) - (s+(W/2)))
|
||||
})
|
||||
cur = res.index(Math.min.apply(Math, res))
|
||||
return cur
|
||||
function getPageNumber(page){
|
||||
if(page != null){
|
||||
return $('.page').index($(page))
|
||||
} else {
|
||||
var s = $('.viewer').scrollLeft()
|
||||
var W = $('.viewer').width()
|
||||
var cur = -1
|
||||
var res = $('.page').map(function(i, e){
|
||||
e = $(e)
|
||||
var l = e.position().left
|
||||
var w = e.width()
|
||||
return Math.abs((l+(w/2)) - (s+(W/2)))
|
||||
})
|
||||
cur = res.index(Math.min.apply(Math, res))
|
||||
return cur
|
||||
}
|
||||
}
|
||||
function setCurrentPage(n){
|
||||
if(n == null){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user