Javascript 在Android中,lightbox从窗口中消失并调整大小
灯箱显示在右侧位置(上/左居中),但当用户缩放时;lightobx保持在相同位置(不考虑窗口/视图已调整大小/裁剪) 您可以单击标题的蓝色按钮 我正在检查灯箱的代码,我可以看到Javascript 在Android中,lightbox从窗口中消失并调整大小,javascript,jquery,android,mobile,lightbox,Javascript,Jquery,Android,Mobile,Lightbox,灯箱显示在右侧位置(上/左居中),但当用户缩放时;lightobx保持在相同位置(不考虑窗口/视图已调整大小/裁剪) 您可以单击标题的蓝色按钮 我正在检查灯箱的代码,我可以看到 $(window).bind('resize', $.proxy(function() { if (this.visible) { this.overlay.resize(); if (!this.maximized) {
$(window).bind('resize', $.proxy(function() {
if (this.visible)
{
this.overlay.resize();
if (!this.maximized) {
this.movebox();
}
}
}, this));
其中MOVEBOX()是:
问题是:我如何正确地计算新高度和新高度,使lightbox在android中遵循srcoll/zoom(在iphone中它也会移动一点)我在的回答可能会让你对这个问题有所了解。我猜您在scrollLeft()方面遇到了某种问题
悲伤的时刻:(
function(w, h) {
var size = { x: $(window).width(), y: $(window).height() };
var scroll = { x: $(window).scrollLeft(), y: $(window).scrollTop() };
var height = h!=null ? h : this.esqueleto.lightbox.outerHeight();
var width = w!=null ? w : this.esqueleto.lightbox.outerWidth();
var y = 0;
var x = 0;
//vertically center
x = scroll.x + ((size.x - width) / 2);
if (this.visible) {
y = scroll.y + (size.y - height) / 2;
} else if (this.options.emergefrom == "bottom") {
y = (scroll.y + size.y + 14);
} else {// top
y = (scroll.y - height) - 14;
}
if (this.visible) {
if (!this.animations.move) {
this.morph(this.esqueleto.move, {
'left' : x
}, 'move');
}
this.morph(this.esqueleto.move, {
'top' : y
}, 'move');
} else {
this.esqueleto.move.css({
'left' : x,
'top' : y
});
}
}