繁体   English   中英

灯箱从Android中调整窗口大小的视图中消失了

[英]lightbox disappears of view from window resize in Android

灯箱显示在正确的位置(顶部/左侧居中),但是当用户缩放时; lightobx保持在相同位置(不考虑窗口/视图已调整大小/裁剪),

您可以在此处单击标题的蓝色按钮进行测试

我正在检查灯箱的代码,我可以看到

$(window).bind('resize', $.proxy(function() {
          if (this.visible)
          {
            this.overlay.resize();
            if (!this.maximized) {
              this.movebox();
            }
          }
        }, this));

MOVEBOX()在哪里:

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
          });
        }
      }

问题是:我该如何正确计算新高度和新高度,以便灯箱在android中跟随srcoll / zoom(在iphone中也会移动一点)

对在Windows上不起作用的window.resize()函数上的move()元素的回答可能会为您提供一些启发。 我猜想您正在使用scrollLeft()遇到某种问题。

悲伤的时刻:(

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM