resize events reverted

This commit is contained in:
Vadim Makeev 2011-07-16 05:13:35 +04:00
parent 1bbce711e6
commit 5094e9831d
1 changed files with 9 additions and 7 deletions

View File

@ -12,12 +12,12 @@
} }
function resizeFull(p) { function resizeFull(p) {
if(p) { if(typeof p == 'boolean' && !p) {
var transform = 'none';
} else {
var sx = body.clientWidth / window.innerWidth, var sx = body.clientWidth / window.innerWidth,
sy = body.clientHeight / window.innerHeight, sy = body.clientHeight / window.innerHeight,
transform = 'scale(' + (1/Math.max(sx, sy)) + ')'; transform = 'scale(' + (1/Math.max(sx, sy)) + ')';
} else {
var transform = 'none';
} }
body.style.MozTransform = transform; body.style.MozTransform = transform;
body.style.WebkitTransform = transform; body.style.WebkitTransform = transform;
@ -71,16 +71,18 @@
function enterFull(e) { function enterFull(e) {
body.className = 'full'; body.className = 'full';
resizeFull(1); resizeFull(true);
turnSlide(e); turnSlide(e);
if(!isFull()) history.pushState(null, null, url.pathname + '?full' + url.hash); if(!isFull()) history.pushState(null, null, url.pathname + '?full' + url.hash);
window.addEventListener('resize', resizeFull, false);
document.addEventListener('keyup', exitFullEsc, false); document.addEventListener('keyup', exitFullEsc, false);
} }
function exitFull() { function exitFull() {
body.className = 'list'; body.className = 'list';
resizeFull(0); resizeFull(false);
history.pushState(null, null, url.href.replace('?full', '')); history.pushState(null, null, url.href.replace('?full', ''));
window.removeEventListener('resize', resizeFull, false);
document.removeEventListener('keyup', exitFullEsc, false); document.removeEventListener('keyup', exitFullEsc, false);
} }