diff --git a/index.html b/index.html index 325b55c..71bd36f 100755 --- a/index.html +++ b/index.html @@ -758,6 +758,7 @@ $(document).ready(function(){ alternative layout (native scroll) alternative layout (iscroll) + alternative layout (drag)


diff --git a/layout-iscroll.html b/layout-iscroll.html index fcdd8c6..54d8b50 100755 --- a/layout-iscroll.html +++ b/layout-iscroll.html @@ -148,9 +148,6 @@ $(document).ready(function(){ */ }) - // XXX gets overwritten by iscroll... - setElementScale($('.page .content'), 0.5) - /* var touching = false diff --git a/lib/jli.js b/lib/jli.js index aa759ba..c63a918 100755 --- a/lib/jli.js +++ b/lib/jli.js @@ -197,6 +197,7 @@ function unanimated(obj, func, time){ // Return a scale value for the given element(s). // NOTE: this will only return a single scale value... function getElementScale(elem){ + elem = $(elem) //var transform = elem.css('transform') var vendors = ['o', 'moz', 'ms', 'webkit'] var transform = elem.css('transform') diff --git a/magazine.css b/magazine.css index 5ca4f1b..736838e 100755 --- a/magazine.css +++ b/magazine.css @@ -205,6 +205,14 @@ body { -ms-transition: none; transition: none; } +.dragging * { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} /* user hints, visible when user draggs past the cover or the last page * of the mag... */ .magazine:before, .magazine:after { diff --git a/magazine.js b/magazine.js index b782067..10cfc58 100755 --- a/magazine.js +++ b/magazine.js @@ -248,6 +248,36 @@ function shiftMagazineTo(offset){ }) } } +// XXX this is almost the same as getElementScale... +function getElementShift(elem){ + elem = $(elem) + var vendors = ['o', 'moz', 'ms', 'webkit'] + var transform = elem.css('transform') + var res + + // go through vendor prefixes... (hate this!) + if(!transform || transform == 'none'){ + for(var i in vendors){ + transform = elem.css('-' + vendors[i] + '-transform') + if(transform && transform != 'none'){ + break + } + } + } + // no transform is set... + if(!transform || transform == 'none'){ + return {left: 0, top: 0} + } + //return parseFloat(/translate\(([-.0-9]*),/.exec(transform)[1]) + return { + left: parseFloat(/(translate\(|matrix\([^,]*,[^,]*,[^,]*,[^,]*,)([^,]*),/.exec(transform)[2]), + top: null + } +} + +function getMagazineShift(){ + return getElementShift($('.magazine')).left +}