added transform-based setCurrentPage to index.html...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-02-14 07:33:04 +04:00
parent 03eaa07bc0
commit 98df17477e

View File

@ -52,6 +52,8 @@ var UPDATE_HASH_URL_POSITION = false
// NOTE: partial history navigation over links will still work. // NOTE: partial history navigation over links will still work.
var FULL_HISTORY_ENABLED = false var FULL_HISTORY_ENABLED = false
var USE_TRANSFORM = true
/*********************************************************** modes ***/ /*********************************************************** modes ***/
@ -590,11 +592,24 @@ function setCurrentPage(n, offset, width){
cur.addClass('current') cur.addClass('current')
var mag = $('.magazine') var mag = $('.magazine')
mag.css({ if(USE_TRANSFORM){
// NOTE: this will be wrong during a transition, that's why we var transform = 'translate('+
// can pass the pre-calculated offset as an argument... -(offset == null ? cur.position()['left']/getPageScale() : offset) +
left: -(offset == null ? cur.position()['left']/getPageScale() : offset) 'px, 0px) translateZ(0px)'
}) mag.css({
'-ms-transform' : transform,
'-webkit-transform' : transform,
'-moz-transform' : transform,
'-o-transform' : transform,
'transform' : transform,
})
} else {
mag.css({
// NOTE: this will be wrong during a transition, that's why we
// can pass the pre-calculated offset as an argument...
left: -(offset == null ? cur.position()['left']/getPageScale() : offset)
})
}
// center the pages correctly... // center the pages correctly...
// NOTE: this is the main reason we need width, and we can get it // NOTE: this is the main reason we need width, and we can get it